test_p2p_channel.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. # P2P channel selection test cases
  2. # Copyright (c) 2014, Jouni Malinen <j@w1.fi>
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import logging
  7. logger = logging.getLogger()
  8. import os
  9. import subprocess
  10. import time
  11. import hostapd
  12. import hwsim_utils
  13. from wpasupplicant import WpaSupplicant
  14. from hwsim import HWSimRadio
  15. from test_p2p_grpform import go_neg_pin_authorized
  16. from test_p2p_grpform import check_grpform_results
  17. from test_p2p_grpform import remove_group
  18. from test_p2p_grpform import go_neg_pbc
  19. from test_p2p_autogo import autogo
  20. def set_country(country):
  21. subprocess.call(['sudo', 'iw', 'reg', 'set', country])
  22. time.sleep(0.1)
  23. def test_p2p_channel_5ghz(dev):
  24. """P2P group formation with 5 GHz preference"""
  25. try:
  26. set_country("US")
  27. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  28. r_dev=dev[1], r_intent=0,
  29. test_data=False)
  30. check_grpform_results(i_res, r_res)
  31. freq = int(i_res['freq'])
  32. if freq < 5000:
  33. raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
  34. remove_group(dev[0], dev[1])
  35. finally:
  36. set_country("00")
  37. def test_p2p_channel_5ghz_no_vht(dev):
  38. """P2P group formation with 5 GHz preference when VHT channels are disallowed"""
  39. try:
  40. set_country("US")
  41. dev[0].request("P2P_SET disallow_freq 5180-5240")
  42. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  43. r_dev=dev[1], r_intent=0,
  44. test_data=False)
  45. check_grpform_results(i_res, r_res)
  46. freq = int(i_res['freq'])
  47. if freq < 5000:
  48. raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq)
  49. remove_group(dev[0], dev[1])
  50. finally:
  51. set_country("00")
  52. dev[0].request("P2P_SET disallow_freq ")
  53. def test_p2p_channel_random_social(dev):
  54. """P2P group formation with 5 GHz preference but all 5 GHz channels disabled"""
  55. try:
  56. set_country("US")
  57. dev[0].request("SET p2p_oper_channel 11")
  58. dev[0].request("P2P_SET disallow_freq 5000-6000,2462")
  59. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  60. r_dev=dev[1], r_intent=0,
  61. test_data=False)
  62. check_grpform_results(i_res, r_res)
  63. freq = int(i_res['freq'])
  64. if freq not in [ 2412, 2437, 2462 ]:
  65. raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq)
  66. remove_group(dev[0], dev[1])
  67. finally:
  68. set_country("00")
  69. dev[0].request("P2P_SET disallow_freq ")
  70. def test_p2p_channel_random(dev):
  71. """P2P group formation with 5 GHz preference but all 5 GHz channels and all social channels disabled"""
  72. try:
  73. set_country("US")
  74. dev[0].request("SET p2p_oper_channel 11")
  75. dev[0].request("P2P_SET disallow_freq 5000-6000,2412,2437,2462")
  76. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  77. r_dev=dev[1], r_intent=0,
  78. test_data=False)
  79. check_grpform_results(i_res, r_res)
  80. freq = int(i_res['freq'])
  81. if freq > 2500 or freq in [ 2412, 2437, 2462 ]:
  82. raise Exception("Unexpected channel %d MHz" % freq)
  83. remove_group(dev[0], dev[1])
  84. finally:
  85. set_country("00")
  86. dev[0].request("P2P_SET disallow_freq ")
  87. def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params):
  88. """P2P group formation using random social channel with oper class change needed"""
  89. try:
  90. set_country("US")
  91. logger.info("Start group on 5 GHz")
  92. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  93. r_dev=dev[1], r_intent=0,
  94. test_data=False)
  95. check_grpform_results(i_res, r_res)
  96. freq = int(i_res['freq'])
  97. if freq < 5000:
  98. raise Exception("Unexpected channel %d MHz - did not pick 5 GHz preference" % freq)
  99. remove_group(dev[0], dev[1])
  100. logger.info("Disable 5 GHz and try to re-start group based on 5 GHz preference")
  101. dev[0].request("SET p2p_oper_reg_class 115")
  102. dev[0].request("SET p2p_oper_channel 36")
  103. dev[0].request("P2P_SET disallow_freq 5000-6000")
  104. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  105. r_dev=dev[1], r_intent=0,
  106. test_data=False)
  107. check_grpform_results(i_res, r_res)
  108. freq = int(i_res['freq'])
  109. if freq not in [ 2412, 2437, 2462 ]:
  110. raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq)
  111. remove_group(dev[0], dev[1])
  112. try:
  113. arg = [ "tshark",
  114. "-r", os.path.join(params['logdir'], "hwsim0.pcapng"),
  115. "-Y", "wifi_p2p.public_action.subtype == 0",
  116. "-V" ]
  117. cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
  118. stderr=open('/dev/null', 'w'))
  119. except Exception, e:
  120. logger.info("Could run run tshark check: " + str(e))
  121. cmd = None
  122. pass
  123. if cmd:
  124. last = None
  125. for l in cmd.stdout.read().splitlines():
  126. if "Operating Channel:" not in l:
  127. continue
  128. last = l
  129. if last is None:
  130. raise Exception("Could not find GO Negotiation Request")
  131. if "Operating Class 81" not in last:
  132. raise Exception("Unexpected operating class: " + last.strip())
  133. finally:
  134. set_country("00")
  135. dev[0].request("P2P_SET disallow_freq ")
  136. dev[0].request("SET p2p_oper_reg_class 0")
  137. dev[0].request("SET p2p_oper_channel 0")
  138. def test_p2p_channel_avoid(dev):
  139. """P2P and avoid frequencies driver event"""
  140. try:
  141. set_country("US")
  142. if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES 5000-6000,2412,2437,2462"):
  143. raise Exception("Could not simulate driver event")
  144. ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
  145. if ev is None:
  146. raise Exception("No CTRL-EVENT-AVOID-FREQ event")
  147. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
  148. r_dev=dev[1], r_intent=0,
  149. test_data=False)
  150. check_grpform_results(i_res, r_res)
  151. freq = int(i_res['freq'])
  152. if freq > 2500 or freq in [ 2412, 2437, 2462 ]:
  153. raise Exception("Unexpected channel %d MHz" % freq)
  154. if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES"):
  155. raise Exception("Could not simulate driver event(2)")
  156. ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
  157. if ev is None:
  158. raise Exception("No CTRL-EVENT-AVOID-FREQ event")
  159. ev = dev[0].wait_event(["P2P-REMOVE-AND-REFORM-GROUP"], timeout=1)
  160. if ev is not None:
  161. raise Exception("Unexpected P2P-REMOVE-AND-REFORM-GROUP event")
  162. if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES " + str(freq)):
  163. raise Exception("Could not simulate driver event(3)")
  164. ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
  165. if ev is None:
  166. raise Exception("No CTRL-EVENT-AVOID-FREQ event")
  167. ev = dev[0].wait_event(["P2P-REMOVE-AND-REFORM-GROUP"], timeout=10)
  168. if ev is None:
  169. raise Exception("No P2P-REMOVE-AND-REFORM-GROUP event")
  170. finally:
  171. set_country("00")
  172. dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
  173. def test_autogo_following_bss(dev, apdev):
  174. """P2P autonomous GO operate on the same channel as station interface"""
  175. if dev[0].get_mcc() > 1:
  176. logger.info("test mode: MCC")
  177. dev[0].request("SET p2p_no_group_iface 0")
  178. channels = { 3 : "2422", 5 : "2432", 9 : "2452" }
  179. for key in channels:
  180. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid" : 'ap-test',
  181. "channel" : str(key) })
  182. dev[0].connect("ap-test", key_mgmt="NONE",
  183. scan_freq=str(channels[key]))
  184. res_go = autogo(dev[0])
  185. if res_go['freq'] != channels[key]:
  186. raise Exception("Group operation channel is not the same as on connected station interface")
  187. hwsim_utils.test_connectivity(dev[0], hapd)
  188. dev[0].remove_group(res_go['ifname'])
  189. def test_go_neg_with_bss_connected(dev, apdev):
  190. """P2P channel selection: GO negotiation when station interface is connected"""
  191. dev[0].request("BSS_FLUSH 0")
  192. dev[0].request("SCAN freq=2412 only_new=1")
  193. dev[1].request("BSS_FLUSH 0")
  194. dev[1].request("SCAN freq=2412 only_new=1")
  195. dev[0].request("SET p2p_no_group_iface 0")
  196. hapd = hostapd.add_ap(apdev[0]['ifname'],
  197. { "ssid": 'bss-2.4ghz', "channel": '5' })
  198. dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2432")
  199. #dev[0] as GO
  200. [i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=10, r_dev=dev[1],
  201. r_intent=1)
  202. check_grpform_results(i_res, r_res)
  203. if i_res['role'] != "GO":
  204. raise Exception("GO not selected according to go_intent")
  205. if i_res['freq'] != "2432":
  206. raise Exception("Group formed on a different frequency than BSS")
  207. hwsim_utils.test_connectivity(dev[0], hapd)
  208. dev[0].remove_group(i_res['ifname'])
  209. if dev[0].get_mcc() > 1:
  210. logger.info("Skip as-client case due to MCC being enabled")
  211. return;
  212. #dev[0] as client
  213. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=1, r_dev=dev[1],
  214. r_intent=10)
  215. check_grpform_results(i_res2, r_res2)
  216. if i_res2['role'] != "client":
  217. raise Exception("GO not selected according to go_intent")
  218. if i_res2['freq'] != "2432":
  219. raise Exception("Group formed on a different frequency than BSS")
  220. hwsim_utils.test_connectivity(dev[0], hapd)
  221. def test_autogo_with_bss_on_disallowed_chan(dev, apdev):
  222. """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""
  223. with HWSimRadio(n_channels=2) as (radio, iface):
  224. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  225. wpas.interface_add(iface)
  226. wpas.request("SET p2p_no_group_iface 0")
  227. if wpas.get_mcc() < 2:
  228. raise Exception("New radio does not support MCC")
  229. try:
  230. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
  231. "channel": '1' })
  232. wpas.request("P2P_SET disallow_freq 2412")
  233. wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  234. res = autogo(wpas)
  235. if res['freq'] == "2412":
  236. raise Exception("GO set on a disallowed channel")
  237. hwsim_utils.test_connectivity(wpas, hapd)
  238. finally:
  239. wpas.request("P2P_SET disallow_freq ")
  240. def test_go_neg_with_bss_on_disallowed_chan(dev, apdev):
  241. """P2P channel selection: GO negotiation with station interface on a disallowed channel"""
  242. with HWSimRadio(n_channels=2) as (radio, iface):
  243. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  244. wpas.interface_add(iface)
  245. wpas.request("SET p2p_no_group_iface 0")
  246. if wpas.get_mcc() < 2:
  247. raise Exception("New radio does not support MCC")
  248. try:
  249. hapd = hostapd.add_ap(apdev[0]['ifname'],
  250. { "ssid": 'bss-2.4ghz', "channel": '1' })
  251. wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  252. wpas.request("P2P_SET disallow_freq 2412")
  253. #wpas as GO
  254. [i_res, r_res] = go_neg_pbc(i_dev=wpas, i_intent=10, r_dev=dev[1],
  255. r_intent=1)
  256. check_grpform_results(i_res, r_res)
  257. if i_res['role'] != "GO":
  258. raise Exception("GO not selected according to go_intent")
  259. if i_res['freq'] == "2412":
  260. raise Exception("Group formed on a disallowed channel")
  261. hwsim_utils.test_connectivity(wpas, hapd)
  262. wpas.remove_group(i_res['ifname'])
  263. #wpas as client
  264. [i_res2, r_res2] = go_neg_pbc(i_dev=wpas, i_intent=1, r_dev=dev[1],
  265. r_intent=10)
  266. check_grpform_results(i_res2, r_res2)
  267. if i_res2['role'] != "client":
  268. raise Exception("GO not selected according to go_intent")
  269. if i_res2['freq'] == "2412":
  270. raise Exception("Group formed on a disallowed channel")
  271. hwsim_utils.test_connectivity(wpas, hapd)
  272. finally:
  273. wpas.request("P2P_SET disallow_freq ")
  274. def test_autogo_force_diff_channel(dev, apdev):
  275. """P2P autonomous GO and station interface operate on different channels"""
  276. with HWSimRadio(n_channels=2) as (radio, iface):
  277. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  278. wpas.interface_add(iface)
  279. if wpas.get_mcc() < 2:
  280. raise Exception("New radio does not support MCC")
  281. wpas.request("SET p2p_no_group_iface 0")
  282. hapd = hostapd.add_ap(apdev[0]['ifname'],
  283. {"ssid" : 'ap-test', "channel" : '1'})
  284. wpas.connect("ap-test", key_mgmt = "NONE", scan_freq = "2412")
  285. channels = { 2 : 2417, 5 : 2432, 9 : 2452 }
  286. for key in channels:
  287. res_go = autogo(wpas, channels[key])
  288. hwsim_utils.test_connectivity(wpas, hapd)
  289. if int(res_go['freq']) == 2412:
  290. raise Exception("Group operation channel is: 2412 excepted: " + res_go['freq'])
  291. wpas.remove_group(res_go['ifname'])
  292. def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
  293. """P2P channel selection: GO negotiation with forced freq different than station interface"""
  294. with HWSimRadio(n_channels=2) as (radio, iface):
  295. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  296. wpas.interface_add(iface)
  297. if wpas.get_mcc() < 2:
  298. raise Exception("New radio does not support MCC")
  299. wpas.request("SET p2p_no_group_iface 0")
  300. hapd = hostapd.add_ap(apdev[0]['ifname'],
  301. { "country_code": 'US',
  302. "ssid": 'bss-5ghz', "hw_mode": 'a',
  303. "channel": '40' })
  304. wpas.connect("bss-5ghz", key_mgmt="NONE", scan_freq="5200")
  305. # GO and peer force the same freq, different than BSS freq,
  306. # wpas to become GO
  307. [i_res, r_res] = go_neg_pbc(i_dev=dev[1], i_intent=1, i_freq=5180,
  308. r_dev=wpas, r_intent=14, r_freq=5180)
  309. check_grpform_results(i_res, r_res)
  310. if i_res['freq'] != "5180":
  311. raise Exception("P2P group formed on unexpected frequency: " + i_res['freq'])
  312. if r_res['role'] != "GO":
  313. raise Exception("GO not selected according to go_intent")
  314. hwsim_utils.test_connectivity(wpas, hapd)
  315. wpas.remove_group(r_res['ifname'])
  316. # GO and peer force the same freq, different than BSS freq, wpas to
  317. # become client
  318. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[1], i_intent=14, i_freq=2422,
  319. r_dev=wpas, r_intent=1, r_freq=2422)
  320. check_grpform_results(i_res2, r_res2)
  321. if i_res2['freq'] != "2422":
  322. raise Exception("P2P group formed on unexpected frequency: " + i_res2['freq'])
  323. if r_res2['role'] != "client":
  324. raise Exception("GO not selected according to go_intent")
  325. hwsim_utils.test_connectivity(wpas, hapd)
  326. def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
  327. """P2P channel selection: Station on different channel than GO configured pref channel"""
  328. dev[0].request("SET p2p_no_group_iface 0")
  329. try:
  330. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
  331. "channel": '1' })
  332. dev[0].request("SET p2p_pref_chan 81:2")
  333. dev[0].connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  334. res = autogo(dev[0])
  335. if res['freq'] != "2412":
  336. raise Exception("GO channel did not follow BSS")
  337. hwsim_utils.test_connectivity(dev[0], hapd)
  338. finally:
  339. dev[0].request("SET p2p_pref_chan ")
  340. def test_go_pref_chan_bss_on_disallowed_chan(dev, apdev):
  341. """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
  342. with HWSimRadio(n_channels=2) as (radio, iface):
  343. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  344. wpas.interface_add(iface)
  345. if wpas.get_mcc() < 2:
  346. raise Exception("New radio does not support MCC")
  347. wpas.request("SET p2p_no_group_iface 0")
  348. try:
  349. hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": 'bss-2.4ghz',
  350. "channel": '1' })
  351. wpas.request("P2P_SET disallow_freq 2412")
  352. wpas.request("SET p2p_pref_chan 81:2")
  353. wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
  354. res2 = autogo(wpas)
  355. if res2['freq'] != "2417":
  356. raise Exception("GO channel did not follow pref_chan configuration")
  357. hwsim_utils.test_connectivity(wpas, hapd)
  358. finally:
  359. wpas.request("P2P_SET disallow_freq ")
  360. wpas.request("SET p2p_pref_chan ")
  361. def test_no_go_freq(dev, apdev):
  362. """P2P channel selection: no GO freq"""
  363. try:
  364. dev[0].request("SET p2p_no_go_freq 2412")
  365. # dev[0] as client, channel 1 is ok
  366. [i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=1,
  367. r_dev=dev[1], r_intent=14, r_freq=2412)
  368. check_grpform_results(i_res, r_res)
  369. if i_res['freq'] != "2412":
  370. raise Exception("P2P group not formed on forced freq")
  371. dev[1].remove_group(r_res['ifname'])
  372. fail = False
  373. # dev[0] as GO, channel 1 is not allowed
  374. try:
  375. dev[0].request("SET p2p_no_go_freq 2412")
  376. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14,
  377. r_dev=dev[1], r_intent=1, r_freq=2412)
  378. check_grpform_results(i_res2, r_res2)
  379. fail = True
  380. except:
  381. pass
  382. if fail:
  383. raise Exception("GO set on a disallowed freq")
  384. finally:
  385. dev[0].request("SET p2p_no_go_freq ")
  386. def test_go_neg_peers_force_diff_freq(dev, apdev):
  387. try:
  388. [i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14, i_freq=5180,
  389. r_dev=dev[1], r_intent=0, r_freq=5200)
  390. except Exception, e:
  391. return
  392. raise Exception("Unexpected group formation success")
  393. def test_autogo_random_channel(dev, apdev):
  394. """P2P channel selection: GO instantiated on random channel 1, 6, 11"""
  395. freqs = []
  396. go_freqs = ["2412", "2437", "2462"]
  397. for i in range(0, 20):
  398. result = autogo(dev[0])
  399. if result['freq'] not in go_freqs:
  400. raise Exception("Unexpected frequency selected: " + result['freq'])
  401. if result['freq'] not in freqs:
  402. freqs.append(result['freq'])
  403. if len(freqs) == 3:
  404. break
  405. dev[0].remove_group(result['ifname'])
  406. if i == 20:
  407. raise Exception("GO created 20 times and not all social channels were selected. freqs not selected: " + str(list(set(go_freqs) - set(freqs))))
  408. def test_p2p_autogo_pref_chan_disallowed(dev, apdev):
  409. """P2P channel selection: GO preferred channels are disallowed"""
  410. try:
  411. dev[0].request("SET p2p_pref_chan 81:1,81:3,81:6,81:9,81:11")
  412. dev[0].request("P2P_SET disallow_freq 2412,2422,2437,2452,2462")
  413. for i in range(0, 5):
  414. res = autogo(dev[0])
  415. if res['freq'] in [ "2412", "2422", "2437", "2452", "2462" ]:
  416. raise Exception("GO channel is disallowed")
  417. dev[0].remove_group(res['ifname'])
  418. finally:
  419. dev[0].request("P2P_SET disallow_freq ")
  420. dev[0].request("SET p2p_pref_chan ")
  421. def test_p2p_autogo_pref_chan_not_in_regulatory(dev, apdev):
  422. """P2P channel selection: GO preferred channel not allowed in the regulatory rules"""
  423. try:
  424. set_country("US")
  425. dev[0].request("SET p2p_pref_chan 124:149")
  426. res = autogo(dev[0], persistent=True)
  427. if res['freq'] != "5745":
  428. raise Exception("Unexpected channel selected: " + res['freq'])
  429. dev[0].remove_group(res['ifname'])
  430. netw = dev[0].list_networks()
  431. if len(netw) != 1:
  432. raise Exception("Unexpected number of network blocks: " + str(netw))
  433. id = netw[0]['id']
  434. set_country("DE")
  435. res = autogo(dev[0], persistent=id)
  436. if res['freq'] == "5745":
  437. raise Exception("Unexpected channel selected(2): " + res['freq'])
  438. dev[0].remove_group(res['ifname'])
  439. finally:
  440. dev[0].request("SET p2p_pref_chan ")
  441. set_country("00")