]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/test_p2p_channel.py
1 # P2P channel selection test cases
2 # Copyright (c) 2014, Jouni Malinen <j@w1.fi>
4 # This software may be distributed under the terms of the BSD license.
5 # See README for more details.
7 from remotehost
import remote_compatible
9 logger
= logging
.getLogger()
16 from tshark
import run_tshark
17 from wpasupplicant
import WpaSupplicant
18 from hwsim
import HWSimRadio
19 from p2p_utils
import *
21 def set_country(country
, dev
=None):
22 subprocess
.call(['iw', 'reg', 'set', country
])
26 ev
= dev
.wait_global_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout
=15)
28 raise Exception("No regdom change event seen")
29 if "type=COUNTRY alpha2=" + country
in ev
:
31 raise Exception("No matching regdom event seen for set_country(%s)" % country
)
33 def test_p2p_channel_5ghz(dev
):
34 """P2P group formation with 5 GHz preference"""
36 set_country("US", dev
[0])
37 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
38 r_dev
=dev
[1], r_intent
=0,
40 check_grpform_results(i_res
, r_res
)
41 freq
= int(i_res
['freq'])
43 raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq
)
44 remove_group(dev
[0], dev
[1])
47 dev
[1].flush_scan_cache()
49 def test_p2p_channel_5ghz_no_vht(dev
):
50 """P2P group formation with 5 GHz preference when VHT channels are disallowed"""
52 set_country("US", dev
[0])
53 dev
[0].global_request("P2P_SET disallow_freq 5180-5240")
54 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
55 r_dev
=dev
[1], r_intent
=0,
57 check_grpform_results(i_res
, r_res
)
58 freq
= int(i_res
['freq'])
60 raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq
)
61 remove_group(dev
[0], dev
[1])
64 dev
[0].global_request("P2P_SET disallow_freq ")
65 dev
[1].flush_scan_cache()
67 def test_p2p_channel_random_social(dev
):
68 """P2P group formation with 5 GHz preference but all 5 GHz channels disabled"""
70 set_country("US", dev
[0])
71 dev
[0].global_request("SET p2p_oper_channel 11")
72 dev
[0].global_request("P2P_SET disallow_freq 5000-6000,2462")
73 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
74 r_dev
=dev
[1], r_intent
=0,
76 check_grpform_results(i_res
, r_res
)
77 freq
= int(i_res
['freq'])
78 if freq
not in [ 2412, 2437, 2462 ]:
79 raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq
)
80 remove_group(dev
[0], dev
[1])
83 dev
[0].global_request("P2P_SET disallow_freq ")
84 dev
[1].flush_scan_cache()
86 def test_p2p_channel_random(dev
):
87 """P2P group formation with 5 GHz preference but all 5 GHz channels and all social channels disabled"""
89 set_country("US", dev
[0])
90 dev
[0].global_request("SET p2p_oper_channel 11")
91 dev
[0].global_request("P2P_SET disallow_freq 5000-6000,2412,2437,2462")
92 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
93 r_dev
=dev
[1], r_intent
=0,
95 check_grpform_results(i_res
, r_res
)
96 freq
= int(i_res
['freq'])
97 if freq
> 2500 or freq
in [ 2412, 2437, 2462 ]:
98 raise Exception("Unexpected channel %d MHz" % freq
)
99 remove_group(dev
[0], dev
[1])
102 dev
[0].global_request("P2P_SET disallow_freq ")
103 dev
[1].flush_scan_cache()
105 def test_p2p_channel_random_social_with_op_class_change(dev
, apdev
, params
):
106 """P2P group formation using random social channel with oper class change needed"""
108 set_country("US", dev
[0])
109 logger
.info("Start group on 5 GHz")
110 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
111 r_dev
=dev
[1], r_intent
=0,
113 check_grpform_results(i_res
, r_res
)
114 freq
= int(i_res
['freq'])
116 raise Exception("Unexpected channel %d MHz - did not pick 5 GHz preference" % freq
)
117 remove_group(dev
[0], dev
[1])
119 logger
.info("Disable 5 GHz and try to re-start group based on 5 GHz preference")
120 dev
[0].global_request("SET p2p_oper_reg_class 115")
121 dev
[0].global_request("SET p2p_oper_channel 36")
122 dev
[0].global_request("P2P_SET disallow_freq 5000-6000")
123 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
124 r_dev
=dev
[1], r_intent
=0,
126 check_grpform_results(i_res
, r_res
)
127 freq
= int(i_res
['freq'])
128 if freq
not in [ 2412, 2437, 2462 ]:
129 raise Exception("Unexpected channel %d MHz - did not pick random social channel" % freq
)
130 remove_group(dev
[0], dev
[1])
132 out
= run_tshark(os
.path
.join(params
['logdir'], "hwsim0.pcapng"),
133 "wifi_p2p.public_action.subtype == 0")
136 for l
in out
.splitlines():
137 if "Operating Channel:" not in l
:
141 raise Exception("Could not find GO Negotiation Request")
142 if "Operating Class 81" not in last
:
143 raise Exception("Unexpected operating class: " + last
.strip())
146 dev
[0].global_request("P2P_SET disallow_freq ")
147 dev
[0].global_request("SET p2p_oper_reg_class 0")
148 dev
[0].global_request("SET p2p_oper_channel 0")
149 dev
[1].flush_scan_cache()
151 def test_p2p_channel_avoid(dev
):
152 """P2P and avoid frequencies driver event"""
154 set_country("US", dev
[0])
155 if "OK" not in dev
[0].request("DRIVER_EVENT AVOID_FREQUENCIES 5000-6000,2412,2437,2462"):
156 raise Exception("Could not simulate driver event")
157 ev
= dev
[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout
=10)
159 raise Exception("No CTRL-EVENT-AVOID-FREQ event")
160 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
161 r_dev
=dev
[1], r_intent
=0,
163 check_grpform_results(i_res
, r_res
)
164 freq
= int(i_res
['freq'])
165 if freq
> 2500 or freq
in [ 2412, 2437, 2462 ]:
166 raise Exception("Unexpected channel %d MHz" % freq
)
168 if "OK" not in dev
[0].request("DRIVER_EVENT AVOID_FREQUENCIES"):
169 raise Exception("Could not simulate driver event(2)")
170 ev
= dev
[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout
=10)
172 raise Exception("No CTRL-EVENT-AVOID-FREQ event")
173 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
174 "AP-CSA-FINISHED"], timeout
=1)
176 raise Exception("Unexpected + " + ev
+ " event")
178 if "OK" not in dev
[0].request("DRIVER_EVENT AVOID_FREQUENCIES " + str(freq
)):
179 raise Exception("Could not simulate driver event(3)")
180 ev
= dev
[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout
=10)
182 raise Exception("No CTRL-EVENT-AVOID-FREQ event")
183 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
187 raise Exception("No P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED event")
190 dev
[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
191 dev
[1].flush_scan_cache()
194 def test_autogo_following_bss(dev
, apdev
):
195 """P2P autonomous GO operate on the same channel as station interface"""
196 if dev
[0].get_mcc() > 1:
197 logger
.info("test mode: MCC")
199 dev
[0].global_request("SET p2p_no_group_iface 0")
201 channels
= { 3 : "2422", 5 : "2432", 9 : "2452" }
203 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test',
204 "channel" : str(key
) })
205 dev
[0].connect("ap-test", key_mgmt
="NONE",
206 scan_freq
=str(channels
[key
]))
207 res_go
= autogo(dev
[0])
208 if res_go
['freq'] != channels
[key
]:
209 raise Exception("Group operation channel is not the same as on connected station interface")
210 hwsim_utils
.test_connectivity(dev
[0], hapd
)
211 dev
[0].remove_group(res_go
['ifname'])
214 def test_go_neg_with_bss_connected(dev
, apdev
):
215 """P2P channel selection: GO negotiation when station interface is connected"""
217 dev
[0].flush_scan_cache()
218 dev
[1].flush_scan_cache()
219 dev
[0].global_request("SET p2p_no_group_iface 0")
221 hapd
= hostapd
.add_ap(apdev
[0],
222 { "ssid": 'bss-2.4ghz', "channel": '5' })
223 dev
[0].connect("bss-2.4ghz", key_mgmt
="NONE", scan_freq
="2432")
225 [i_res
, r_res
] = go_neg_pbc(i_dev
=dev
[0], i_intent
=10, r_dev
=dev
[1],
227 check_grpform_results(i_res
, r_res
)
228 if i_res
['role'] != "GO":
229 raise Exception("GO not selected according to go_intent")
230 if i_res
['freq'] != "2432":
231 raise Exception("Group formed on a different frequency than BSS")
232 hwsim_utils
.test_connectivity(dev
[0], hapd
)
233 dev
[0].remove_group(i_res
['ifname'])
234 dev
[1].wait_go_ending_session()
236 if dev
[0].get_mcc() > 1:
237 logger
.info("Skip as-client case due to MCC being enabled")
241 [i_res2
, r_res2
] = go_neg_pbc(i_dev
=dev
[0], i_intent
=1, r_dev
=dev
[1],
243 check_grpform_results(i_res2
, r_res2
)
244 if i_res2
['role'] != "client":
245 raise Exception("GO not selected according to go_intent")
246 if i_res2
['freq'] != "2432":
247 raise Exception("Group formed on a different frequency than BSS")
248 hwsim_utils
.test_connectivity(dev
[0], hapd
)
249 dev
[1].remove_group(r_res2
['ifname'])
250 dev
[0].wait_go_ending_session()
251 dev
[0].request("DISCONNECT")
253 dev
[0].flush_scan_cache()
254 dev
[1].flush_scan_cache()
256 def test_autogo_with_bss_on_disallowed_chan(dev
, apdev
):
257 """P2P channel selection: Autonomous GO with BSS on a disallowed channel"""
259 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
260 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
261 wpas
.interface_add(iface
)
263 wpas
.global_request("SET p2p_no_group_iface 0")
265 if wpas
.get_mcc() < 2:
266 raise Exception("New radio does not support MCC")
269 hapd
= hostapd
.add_ap(apdev
[0], { "ssid": 'bss-2.4ghz',
271 wpas
.global_request("P2P_SET disallow_freq 2412")
272 wpas
.connect("bss-2.4ghz", key_mgmt
="NONE", scan_freq
="2412")
274 if res
['freq'] == "2412":
275 raise Exception("GO set on a disallowed channel")
276 hwsim_utils
.test_connectivity(wpas
, hapd
)
278 wpas
.global_request("P2P_SET disallow_freq ")
280 def test_go_neg_with_bss_on_disallowed_chan(dev
, apdev
):
281 """P2P channel selection: GO negotiation with station interface on a disallowed channel"""
283 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
284 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
285 wpas
.interface_add(iface
)
287 wpas
.global_request("SET p2p_no_group_iface 0")
289 if wpas
.get_mcc() < 2:
290 raise Exception("New radio does not support MCC")
293 hapd
= hostapd
.add_ap(apdev
[0],
294 { "ssid": 'bss-2.4ghz', "channel": '1' })
295 # make sure PBC overlap from old test cases is not maintained
296 dev
[1].flush_scan_cache()
297 wpas
.connect("bss-2.4ghz", key_mgmt
="NONE", scan_freq
="2412")
298 wpas
.global_request("P2P_SET disallow_freq 2412")
301 [i_res
, r_res
] = go_neg_pbc(i_dev
=wpas
, i_intent
=10, r_dev
=dev
[1],
303 check_grpform_results(i_res
, r_res
)
304 if i_res
['role'] != "GO":
305 raise Exception("GO not selected according to go_intent")
306 if i_res
['freq'] == "2412":
307 raise Exception("Group formed on a disallowed channel")
308 hwsim_utils
.test_connectivity(wpas
, hapd
)
309 wpas
.remove_group(i_res
['ifname'])
310 dev
[1].wait_go_ending_session()
311 dev
[1].flush_scan_cache()
314 dev
[1].dump_monitor()
317 [i_res2
, r_res2
] = go_neg_pbc(i_dev
=wpas
, i_intent
=1, r_dev
=dev
[1],
319 check_grpform_results(i_res2
, r_res2
)
320 if i_res2
['role'] != "client":
321 raise Exception("GO not selected according to go_intent")
322 if i_res2
['freq'] == "2412":
323 raise Exception("Group formed on a disallowed channel")
324 hwsim_utils
.test_connectivity(wpas
, hapd
)
325 dev
[1].remove_group(r_res2
['ifname'])
326 wpas
.wait_go_ending_session()
327 ev
= dev
[1].wait_global_event(["P2P-GROUP-REMOVED"], timeout
=5)
329 raise Exception("Group removal not indicated")
330 wpas
.request("DISCONNECT")
333 wpas
.global_request("P2P_SET disallow_freq ")
335 def test_autogo_force_diff_channel(dev
, apdev
):
336 """P2P autonomous GO and station interface operate on different channels"""
337 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
338 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
339 wpas
.interface_add(iface
)
341 if wpas
.get_mcc() < 2:
342 raise Exception("New radio does not support MCC")
344 wpas
.global_request("SET p2p_no_group_iface 0")
346 hapd
= hostapd
.add_ap(apdev
[0],
347 {"ssid" : 'ap-test', "channel" : '1'})
348 wpas
.connect("ap-test", key_mgmt
= "NONE", scan_freq
= "2412")
350 channels
= { 2 : 2417, 5 : 2432, 9 : 2452 }
352 res_go
= autogo(wpas
, channels
[key
])
354 hwsim_utils
.test_connectivity(wpas
, hapd
)
355 if int(res_go
['freq']) == 2412:
356 raise Exception("Group operation channel is: 2412 excepted: " + res_go
['freq'])
357 wpas
.remove_group(res_go
['ifname'])
360 def test_go_neg_forced_freq_diff_than_bss_freq(dev
, apdev
):
361 """P2P channel selection: GO negotiation with forced freq different than station interface"""
362 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
363 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
364 wpas
.interface_add(iface
)
366 if wpas
.get_mcc() < 2:
367 raise Exception("New radio does not support MCC")
369 # Clear possible PBC session overlap from previous test case
370 dev
[1].flush_scan_cache()
372 wpas
.global_request("SET p2p_no_group_iface 0")
374 hapd
= hostapd
.add_ap(apdev
[0],
375 { "country_code": 'US',
376 "ssid": 'bss-5ghz', "hw_mode": 'a',
378 wpas
.connect("bss-5ghz", key_mgmt
="NONE", scan_freq
="5200")
380 # GO and peer force the same freq, different than BSS freq,
382 [i_res
, r_res
] = go_neg_pbc(i_dev
=dev
[1], i_intent
=1, i_freq
=5180,
383 r_dev
=wpas
, r_intent
=14, r_freq
=5180)
384 check_grpform_results(i_res
, r_res
)
385 if i_res
['freq'] != "5180":
386 raise Exception("P2P group formed on unexpected frequency: " + i_res
['freq'])
387 if r_res
['role'] != "GO":
388 raise Exception("GO not selected according to go_intent")
389 hwsim_utils
.test_connectivity(wpas
, hapd
)
390 wpas
.remove_group(r_res
['ifname'])
391 dev
[1].wait_go_ending_session()
392 dev
[1].flush_scan_cache()
394 # GO and peer force the same freq, different than BSS freq, wpas to
396 [i_res2
, r_res2
] = go_neg_pbc(i_dev
=dev
[1], i_intent
=14, i_freq
=2422,
397 r_dev
=wpas
, r_intent
=1, r_freq
=2422)
398 check_grpform_results(i_res2
, r_res2
)
399 if i_res2
['freq'] != "2422":
400 raise Exception("P2P group formed on unexpected frequency: " + i_res2
['freq'])
401 if r_res2
['role'] != "client":
402 raise Exception("GO not selected according to go_intent")
403 hwsim_utils
.test_connectivity(wpas
, hapd
)
405 wpas
.request("DISCONNECT")
406 hapd
.request("DISABLE")
407 subprocess
.call(['iw', 'reg', 'set', '00'])
408 wpas
.flush_scan_cache()
411 def test_go_pref_chan_bss_on_diff_chan(dev
, apdev
):
412 """P2P channel selection: Station on different channel than GO configured pref channel"""
414 dev
[0].global_request("SET p2p_no_group_iface 0")
417 hapd
= hostapd
.add_ap(apdev
[0], { "ssid": 'bss-2.4ghz',
419 dev
[0].global_request("SET p2p_pref_chan 81:2")
420 dev
[0].connect("bss-2.4ghz", key_mgmt
="NONE", scan_freq
="2412")
422 if res
['freq'] != "2412":
423 raise Exception("GO channel did not follow BSS")
424 hwsim_utils
.test_connectivity(dev
[0], hapd
)
426 dev
[0].global_request("SET p2p_pref_chan ")
428 def test_go_pref_chan_bss_on_disallowed_chan(dev
, apdev
):
429 """P2P channel selection: Station interface on different channel than GO configured pref channel, and station channel is disallowed"""
430 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
431 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
432 wpas
.interface_add(iface
)
434 if wpas
.get_mcc() < 2:
435 raise Exception("New radio does not support MCC")
437 wpas
.global_request("SET p2p_no_group_iface 0")
440 hapd
= hostapd
.add_ap(apdev
[0], { "ssid": 'bss-2.4ghz',
442 wpas
.global_request("P2P_SET disallow_freq 2412")
443 wpas
.global_request("SET p2p_pref_chan 81:2")
444 wpas
.connect("bss-2.4ghz", key_mgmt
="NONE", scan_freq
="2412")
446 if res2
['freq'] != "2417":
447 raise Exception("GO channel did not follow pref_chan configuration")
448 hwsim_utils
.test_connectivity(wpas
, hapd
)
450 wpas
.global_request("P2P_SET disallow_freq ")
451 wpas
.global_request("SET p2p_pref_chan ")
454 def test_no_go_freq(dev
, apdev
):
455 """P2P channel selection: no GO freq"""
457 dev
[0].global_request("SET p2p_no_go_freq 2412")
458 # dev[0] as client, channel 1 is ok
459 [i_res
, r_res
] = go_neg_pbc(i_dev
=dev
[0], i_intent
=1,
460 r_dev
=dev
[1], r_intent
=14, r_freq
=2412)
461 check_grpform_results(i_res
, r_res
)
462 if i_res
['freq'] != "2412":
463 raise Exception("P2P group not formed on forced freq")
465 dev
[1].remove_group(r_res
['ifname'])
466 dev
[0].wait_go_ending_session()
467 dev
[0].flush_scan_cache()
470 # dev[0] as GO, channel 1 is not allowed
472 dev
[0].global_request("SET p2p_no_go_freq 2412")
473 [i_res2
, r_res2
] = go_neg_pbc(i_dev
=dev
[0], i_intent
=14,
474 r_dev
=dev
[1], r_intent
=1, r_freq
=2412)
475 check_grpform_results(i_res2
, r_res2
)
480 raise Exception("GO set on a disallowed freq")
482 dev
[0].global_request("SET p2p_no_go_freq ")
485 def test_go_neg_peers_force_diff_freq(dev
, apdev
):
486 """P2P channel selection when peers for different frequency"""
488 [i_res2
, r_res2
] = go_neg_pbc(i_dev
=dev
[0], i_intent
=14, i_freq
=5180,
489 r_dev
=dev
[1], r_intent
=0, r_freq
=5200)
492 raise Exception("Unexpected group formation success")
495 def test_autogo_random_channel(dev
, apdev
):
496 """P2P channel selection: GO instantiated on random channel 1, 6, 11"""
498 go_freqs
= ["2412", "2437", "2462"]
499 for i
in range(0, 20):
500 result
= autogo(dev
[0])
501 if result
['freq'] not in go_freqs
:
502 raise Exception("Unexpected frequency selected: " + result
['freq'])
503 if result
['freq'] not in freqs
:
504 freqs
.append(result
['freq'])
507 dev
[0].remove_group(result
['ifname'])
509 raise Exception("GO created 20 times and not all social channels were selected. freqs not selected: " + str(list(set(go_freqs
) - set(freqs
))))
512 def test_p2p_autogo_pref_chan_disallowed(dev
, apdev
):
513 """P2P channel selection: GO preferred channels are disallowed"""
515 dev
[0].global_request("SET p2p_pref_chan 81:1,81:3,81:6,81:9,81:11")
516 dev
[0].global_request("P2P_SET disallow_freq 2412,2422,2437,2452,2462")
517 for i
in range(0, 5):
519 if res
['freq'] in [ "2412", "2422", "2437", "2452", "2462" ]:
520 raise Exception("GO channel is disallowed")
521 dev
[0].remove_group(res
['ifname'])
523 dev
[0].global_request("P2P_SET disallow_freq ")
524 dev
[0].global_request("SET p2p_pref_chan ")
526 def test_p2p_autogo_pref_chan_not_in_regulatory(dev
, apdev
):
527 """P2P channel selection: GO preferred channel not allowed in the regulatory rules"""
529 set_country("US", dev
[0])
530 dev
[0].global_request("SET p2p_pref_chan 124:149")
531 res
= autogo(dev
[0], persistent
=True)
532 if res
['freq'] != "5745":
533 raise Exception("Unexpected channel selected: " + res
['freq'])
534 dev
[0].remove_group(res
['ifname'])
536 netw
= dev
[0].list_networks(p2p
=True)
538 raise Exception("Unexpected number of network blocks: " + str(netw
))
541 set_country("DE", dev
[0])
542 res
= autogo(dev
[0], persistent
=id)
543 if res
['freq'] == "5745":
544 raise Exception("Unexpected channel selected(2): " + res
['freq'])
545 dev
[0].remove_group(res
['ifname'])
547 dev
[0].global_request("SET p2p_pref_chan ")
550 def run_autogo(dev
, param
):
551 if "OK" not in dev
.global_request("P2P_GROUP_ADD " + param
):
552 raise Exception("P2P_GROUP_ADD failed: " + param
)
553 ev
= dev
.wait_global_event(["P2P-GROUP-STARTED"], timeout
=10)
555 raise Exception("GO start up timed out")
556 res
= dev
.group_form_result(ev
)
560 def _test_autogo_ht_vht(dev
):
561 res
= run_autogo(dev
[0], "ht40")
563 res
= run_autogo(dev
[0], "vht")
565 res
= run_autogo(dev
[0], "freq=2")
566 freq
= int(res
['freq'])
567 if freq
< 2412 or freq
> 2462:
568 raise Exception("Unexpected freq=2 channel: " + str(freq
))
570 res
= run_autogo(dev
[0], "freq=5")
571 freq
= int(res
['freq'])
572 if freq
< 5000 or freq
>= 6000:
573 raise Exception("Unexpected freq=5 channel: " + str(freq
))
575 res
= run_autogo(dev
[0], "freq=5 ht40 vht")
576 logger
.info(str(res
))
577 freq
= int(res
['freq'])
578 if freq
< 5000 or freq
>= 6000:
579 raise Exception("Unexpected freq=5 ht40 vht channel: " + str(freq
))
581 def test_autogo_ht_vht(dev
):
582 """P2P autonomous GO with HT/VHT parameters"""
584 set_country("US", dev
[0])
585 _test_autogo_ht_vht(dev
)
589 def test_p2p_listen_chan_optimize(dev
, apdev
):
590 """P2P listen channel optimization"""
591 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
592 wpas
.interface_add("wlan5")
593 addr5
= wpas
.p2p_dev_addr()
595 if "OK" not in wpas
.global_request("SET p2p_optimize_listen_chan 1"):
596 raise Exception("Failed to set p2p_optimize_listen_chan")
598 if not dev
[0].discover_peer(addr5
):
599 raise Exception("Could not discover peer")
600 peer
= dev
[0].get_peer(addr5
)
601 lfreq
= peer
['listen_freq']
603 dev
[0].p2p_stop_find()
605 channel
= "1" if lfreq
!= '2412' else "6"
606 freq
= "2412" if lfreq
!= '2412' else "2437"
607 params
= { "ssid": "test-open", "channel": channel
}
608 hapd
= hostapd
.add_ap(apdev
[0], params
)
610 id = wpas
.connect("test-open", key_mgmt
="NONE", scan_freq
=freq
)
613 if "OK" not in dev
[0].global_request("P2P_FLUSH"):
614 raise Exception("P2P_FLUSH failed")
615 if not dev
[0].discover_peer(addr5
):
616 raise Exception("Could not discover peer")
617 peer
= dev
[0].get_peer(addr5
)
618 lfreq2
= peer
['listen_freq']
620 raise Exception("Listen channel did not change")
622 raise Exception("Listen channel not on AP's operating channel")
624 dev
[0].p2p_stop_find()
626 wpas
.request("DISCONNECT")
627 wpas
.wait_disconnected()
629 # for larger coverage, cover case of current channel matching
630 wpas
.select_network(id)
631 wpas
.wait_connected()
632 wpas
.request("DISCONNECT")
633 wpas
.wait_disconnected()
635 lchannel
= "1" if channel
!= "1" else "6"
636 lfreq3
= "2412" if channel
!= "1" else "2437"
637 if "OK" not in wpas
.global_request("P2P_SET listen_channel " + lchannel
):
638 raise Exception("Failed to set listen channel")
640 wpas
.select_network(id)
641 wpas
.wait_connected()
644 if "OK" not in dev
[0].global_request("P2P_FLUSH"):
645 raise Exception("P2P_FLUSH failed")
646 if not dev
[0].discover_peer(addr5
):
647 raise Exception("Could not discover peer")
648 peer
= dev
[0].get_peer(addr5
)
649 lfreq4
= peer
['listen_freq']
651 raise Exception("Unexpected Listen channel after configuration")
653 dev
[0].p2p_stop_find()
655 wpas
.global_request("SET p2p_optimize_listen_chan 0")
657 def test_p2p_channel_5ghz_only(dev
):
658 """P2P GO start with only 5 GHz band allowed"""
660 set_country("US", dev
[0])
661 dev
[0].global_request("P2P_SET disallow_freq 2400-2500")
663 freq
= int(res
['freq'])
665 raise Exception("Unexpected channel %d MHz" % freq
)
666 dev
[0].remove_group()
669 dev
[0].global_request("P2P_SET disallow_freq ")
671 def test_p2p_channel_5ghz_165_169_us(dev
):
672 """P2P GO and 5 GHz channels 165 (allowed) and 169 (disallowed) in US"""
674 set_country("US", dev
[0])
675 res
= dev
[0].p2p_start_go(freq
=5825)
676 if res
['freq'] != "5825":
677 raise Exception("Unexpected frequency: " + res
['freq'])
678 dev
[0].remove_group()
680 res
= dev
[0].global_request("P2P_GROUP_ADD freq=5845")
681 if "FAIL" not in res
:
682 raise Exception("GO on channel 169 allowed unexpectedly")
686 def wait_go_down_up(dev
):
687 ev
= dev
.wait_group_event(["AP-DISABLED"], timeout
=5)
689 raise Exception("AP-DISABLED not seen after P2P-REMOVE-AND-REFORM-GROUP")
690 ev
= dev
.wait_group_event(["AP-ENABLED"], timeout
=5)
692 raise Exception("AP-ENABLED not seen after P2P-REMOVE-AND-REFORM-GROUP")
694 def test_p2p_go_move_reg_change(dev
, apdev
):
695 """P2P GO move due to regulatory change"""
698 dev
[0].global_request("P2P_SET disallow_freq 2400-5000")
700 freq1
= int(res
['freq'])
702 raise Exception("Unexpected channel %d MHz" % freq1
)
704 dev
[0].global_request("P2P_SET disallow_freq ")
706 # GO move is not allowed while waiting for initial client connection
707 connect_cli(dev
[0], dev
[1], freq
=freq1
)
708 dev
[1].remove_group()
710 freq
= dev
[0].get_group_status_field('freq')
712 raise Exception("Unexpected freq after initial client: " + freq
)
713 dev
[0].dump_monitor()
716 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
720 raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
721 if "P2P-REMOVE-AND-REFORM-GROUP" in ev
:
722 wait_go_down_up(dev
[0])
724 freq2
= dev
[0].get_group_status_field('freq')
726 raise Exception("Unexpected freq after group reform=" + freq2
)
728 dev
[0].remove_group()
730 dev
[0].global_request("P2P_SET disallow_freq ")
733 def test_p2p_go_move_active(dev
, apdev
):
734 """P2P GO stays in freq although SCM is possible"""
735 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
736 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
737 wpas
.interface_add(iface
)
739 if wpas
.get_mcc() < 2:
740 raise Exception("New radio does not support MCC")
742 ndev
= [ wpas
, dev
[1] ]
743 _test_p2p_go_move_active(ndev
, apdev
)
745 def _test_p2p_go_move_active(dev
, apdev
):
746 dev
[0].global_request("SET p2p_no_group_iface 0")
748 dev
[0].global_request("P2P_SET disallow_freq 2430-6000")
749 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test',
751 dev
[0].connect("ap-test", key_mgmt
="NONE",
755 freq
= int(res
['freq'])
757 raise Exception("Unexpected channel %d MHz" % freq
)
759 # GO move is not allowed while waiting for initial client connection
760 connect_cli(dev
[0], dev
[1], freq
=freq
)
761 dev
[1].remove_group()
763 freq
= dev
[0].get_group_status_field('freq')
765 raise Exception("Unexpected freq after initial client: " + freq
)
767 dev
[0].dump_monitor()
768 dev
[0].global_request("P2P_SET disallow_freq ")
770 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
774 raise Exception("Unexpected P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED seen")
776 dev
[0].remove_group()
778 dev
[0].global_request("P2P_SET disallow_freq ")
780 def test_p2p_go_move_scm(dev
, apdev
):
781 """P2P GO move due to SCM operation preference"""
782 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
783 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
784 wpas
.interface_add(iface
)
786 if wpas
.get_mcc() < 2:
787 raise Exception("New radio does not support MCC")
789 ndev
= [ wpas
, dev
[1] ]
790 _test_p2p_go_move_scm(ndev
, apdev
)
792 def _test_p2p_go_move_scm(dev
, apdev
):
793 dev
[0].global_request("SET p2p_no_group_iface 0")
795 dev
[0].global_request("P2P_SET disallow_freq 2430-6000")
796 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test',
798 dev
[0].connect("ap-test", key_mgmt
="NONE",
801 dev
[0].global_request("SET p2p_go_freq_change_policy 0")
803 freq
= int(res
['freq'])
805 raise Exception("Unexpected channel %d MHz" % freq
)
807 # GO move is not allowed while waiting for initial client connection
808 connect_cli(dev
[0], dev
[1], freq
=freq
)
809 dev
[1].remove_group()
811 freq
= dev
[0].get_group_status_field('freq')
813 raise Exception("Unexpected freq after initial client: " + freq
)
815 dev
[0].dump_monitor()
816 dev
[0].global_request("P2P_SET disallow_freq ")
818 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
819 "AP-CSA-FINISHED"], timeout
=3)
821 raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
822 if "P2P-REMOVE-AND-REFORM-GROUP" in ev
:
823 wait_go_down_up(dev
[0])
825 freq
= dev
[0].get_group_status_field('freq')
827 raise Exception("Unexpected freq after group reform=" + freq
)
829 dev
[0].remove_group()
831 dev
[0].global_request("P2P_SET disallow_freq ")
832 dev
[0].global_request("SET p2p_go_freq_change_policy 2")
834 def test_p2p_go_move_scm_peer_supports(dev
, apdev
):
835 """P2P GO move due to SCM operation preference (peer supports)"""
836 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
837 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
838 wpas
.interface_add(iface
)
840 if wpas
.get_mcc() < 2:
841 raise Exception("New radio does not support MCC")
843 ndev
= [ wpas
, dev
[1] ]
844 _test_p2p_go_move_scm_peer_supports(ndev
, apdev
)
846 def _test_p2p_go_move_scm_peer_supports(dev
, apdev
):
848 dev
[0].global_request("SET p2p_go_freq_change_policy 1")
849 set_country("US", dev
[0])
851 dev
[0].global_request("SET p2p_no_group_iface 0")
852 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
853 r_dev
=dev
[1], r_intent
=0,
855 check_grpform_results(i_res
, r_res
)
856 freq
= int(i_res
['freq'])
858 raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq
)
860 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test',
862 logger
.info('Connecting client to to an AP on channel 11');
863 dev
[0].connect("ap-test", key_mgmt
="NONE",
866 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
867 "AP-CSA-FINISHED"], timeout
=3)
869 raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
870 if "P2P-REMOVE-AND-REFORM-GROUP" in ev
:
871 wait_go_down_up(dev
[0])
873 freq
= dev
[0].get_group_status_field('freq')
875 raise Exception("Unexpected freq after group reform=" + freq
)
877 dev
[0].remove_group()
879 dev
[0].global_request("SET p2p_go_freq_change_policy 2")
882 def test_p2p_go_move_scm_peer_does_not_support(dev
, apdev
):
883 """No P2P GO move due to SCM operation (peer does not supports)"""
884 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
885 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
886 wpas
.interface_add(iface
)
888 if wpas
.get_mcc() < 2:
889 raise Exception("New radio does not support MCC")
891 ndev
= [ wpas
, dev
[1] ]
892 _test_p2p_go_move_scm_peer_does_not_support(ndev
, apdev
)
894 def _test_p2p_go_move_scm_peer_does_not_support(dev
, apdev
):
896 dev
[0].global_request("SET p2p_go_freq_change_policy 1")
897 set_country("US", dev
[0])
899 dev
[0].global_request("SET p2p_no_group_iface 0")
900 if "OK" not in dev
[1].request("DRIVER_EVENT AVOID_FREQUENCIES 2400-2500"):
901 raise Exception("Could not simulate driver event")
902 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
903 r_dev
=dev
[1], r_intent
=0,
905 check_grpform_results(i_res
, r_res
)
906 freq
= int(i_res
['freq'])
908 raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq
)
910 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test',
912 logger
.info('Connecting client to to an AP on channel 11');
913 dev
[0].connect("ap-test", key_mgmt
="NONE",
916 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
920 raise Exception("Unexpected P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED seen")
922 dev
[0].remove_group()
924 dev
[0].global_request("SET p2p_go_freq_change_policy 2")
925 dev
[1].request("DRIVER_EVENT AVOID_FREQUENCIES")
928 def test_p2p_go_move_scm_multi(dev
, apdev
):
929 """P2P GO move due to SCM operation preference multiple times"""
930 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
931 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
932 wpas
.interface_add(iface
)
934 if wpas
.get_mcc() < 2:
935 raise Exception("New radio does not support MCC")
937 ndev
= [ wpas
, dev
[1] ]
938 _test_p2p_go_move_scm_multi(ndev
, apdev
)
940 def _test_p2p_go_move_scm_multi(dev
, apdev
):
941 dev
[0].request("SET p2p_no_group_iface 0")
943 dev
[0].global_request("P2P_SET disallow_freq 2430-6000")
944 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test-1',
946 dev
[0].connect("ap-test-1", key_mgmt
="NONE",
949 dev
[0].global_request("SET p2p_go_freq_change_policy 0")
951 freq
= int(res
['freq'])
953 raise Exception("Unexpected channel %d MHz" % freq
)
955 # GO move is not allowed while waiting for initial client connection
956 connect_cli(dev
[0], dev
[1], freq
=freq
)
957 dev
[1].remove_group()
959 freq
= dev
[0].get_group_status_field('freq')
961 raise Exception("Unexpected freq after initial client: " + freq
)
963 dev
[0].dump_monitor()
964 dev
[0].global_request("P2P_SET disallow_freq ")
966 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
967 "AP-CSA-FINISHED"], timeout
=3)
969 raise Exception("P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
970 if "P2P-REMOVE-AND-REFORM-GROUP" in ev
:
971 wait_go_down_up(dev
[0])
973 freq
= dev
[0].get_group_status_field('freq')
975 raise Exception("Unexpected freq after group reform=" + freq
)
977 hapd
= hostapd
.add_ap(apdev
[0], { "ssid" : 'ap-test-2',
979 dev
[0].connect("ap-test-2", key_mgmt
="NONE",
982 ev
= dev
[0].wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
983 "AP-CSA-FINISHED"], timeout
=5)
985 raise Exception("(2) P2P-REMOVE-AND-REFORM-GROUP or AP-CSA-FINISHED not seen")
986 if "P2P-REMOVE-AND-REFORM-GROUP" in ev
:
987 wait_go_down_up(dev
[0])
989 freq
= dev
[0].get_group_status_field('freq')
991 raise Exception("(2) Unexpected freq after group reform=" + freq
)
993 dev
[0].remove_group()
995 dev
[0].global_request("P2P_SET disallow_freq ")
996 dev
[0].global_request("SET p2p_go_freq_change_policy 2")
998 def test_p2p_delay_go_csa(dev
, apdev
, params
):
999 """P2P GO CSA delayed when inviting a P2P Device to an active P2P Group"""
1000 with
HWSimRadio(n_channels
=2) as (radio
, iface
):
1001 wpas
= WpaSupplicant(global_iface
='/tmp/wpas-wlan5')
1002 wpas
.interface_add(iface
)
1004 wpas
.global_request("SET p2p_no_group_iface 0")
1006 if wpas
.get_mcc() < 2:
1007 raise Exception("New radio does not support MCC")
1009 addr0
= wpas
.p2p_dev_addr()
1010 addr1
= dev
[1].p2p_dev_addr()
1013 dev
[1].p2p_listen();
1014 if not wpas
.discover_peer(addr1
, social
=True):
1015 raise Exception("Peer " + addr1
+ " not found")
1016 wpas
.p2p_stop_find()
1018 hapd
= hostapd
.add_ap(apdev
[0], { "ssid": 'bss-2.4ghz',
1021 wpas
.connect("bss-2.4ghz", key_mgmt
="NONE", scan_freq
="2412")
1023 wpas
.global_request("SET p2p_go_freq_change_policy 0")
1026 logger
.info("Start GO on channel 6")
1027 res
= autogo(wpas
, freq
=2437)
1028 if res
['freq'] != "2437":
1029 raise Exception("GO set on a freq=%s instead of 2437" % res
['freq'])
1031 # Start find on dev[1] to run scans with dev[2] in parallel
1032 dev
[1].p2p_find(social
=True)
1034 # Use another client device to stop the initial client connection
1036 if not dev
[2].discover_peer(addr0
, social
=True):
1037 raise Exception("Peer2 did not find the GO")
1038 dev
[2].p2p_stop_find()
1039 pin
= dev
[2].wps_read_pin()
1040 wpas
.p2p_go_authorize_client(pin
)
1041 dev
[2].global_request("P2P_CONNECT " + addr0
+ " " + pin
+ " join freq=2437")
1042 ev
= dev
[2].wait_global_event(["P2P-GROUP-STARTED"], timeout
=10)
1044 raise Exception("Peer2 did not get connected")
1046 if not dev
[1].discover_peer(addr0
, social
=True):
1047 raise Exception("Peer did not find the GO")
1049 pin
= dev
[1].wps_read_pin()
1050 dev
[1].global_request("P2P_CONNECT " + addr0
+ " " + pin
+ " join auth")
1051 dev
[1].p2p_listen();
1053 # Force P2P GO channel switch on successful invitation signaling
1054 wpas
.group_request("SET p2p_go_csa_on_inv 1")
1056 logger
.info("Starting invitation")
1057 wpas
.p2p_go_authorize_client(pin
)
1058 wpas
.global_request("P2P_INVITE group=" + wpas
.group_ifname
+ " peer=" + addr1
)
1059 ev
= dev
[1].wait_global_event(["P2P-INVITATION-RECEIVED",
1060 "P2P-GROUP-STARTED"], timeout
=10)
1063 raise Exception("Timeout on invitation on peer")
1064 if "P2P-INVITATION-RECEIVED" in ev
:
1065 raise Exception("Unexpected request to accept pre-authorized invitation")
1067 # A P2P GO move is not expected at this stage, as during the
1068 # invitation signaling, the P2P GO includes only its current
1069 # operating channel in the channel list, and as the invitation
1070 # response can only include channels that were also in the
1071 # invitation request channel list, the group common channels
1072 # includes only the current P2P GO operating channel.
1073 ev
= wpas
.wait_group_event(["P2P-REMOVE-AND-REFORM-GROUP",
1074 "AP-CSA-FINISHED"], timeout
=1)
1076 raise Exception("Unexpected + " + ev
+ " event")
1079 wpas
.global_request("SET p2p_go_freq_change_policy 2")
1081 def test_p2p_channel_vht80p80(dev
):
1082 """P2P group formation and VHT 80+80 MHz channel"""
1084 set_country("US", dev
[0])
1085 [i_res
, r_res
] = go_neg_pin_authorized(i_dev
=dev
[0], i_intent
=15,
1088 i_max_oper_chwidth
=160,
1089 i_ht40
=True, i_vht
=True,
1090 r_dev
=dev
[1], r_intent
=0,
1092 check_grpform_results(i_res
, r_res
)
1093 freq
= int(i_res
['freq'])
1095 raise Exception("Unexpected channel %d MHz - did not follow 5 GHz preference" % freq
)
1096 sig
= dev
[1].group_request("SIGNAL_POLL").splitlines()
1097 if "FREQUENCY=5180" not in sig
:
1098 raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig
))
1099 if "WIDTH=80+80 MHz" not in sig
:
1100 raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig
))
1101 if "CENTER_FRQ1=5210" not in sig
:
1102 raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig
))
1103 if "CENTER_FRQ2=5775" not in sig
:
1104 raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig
))
1105 remove_group(dev
[0], dev
[1])
1108 dev
[1].flush_scan_cache()
1110 def test_p2p_channel_vht80p80_autogo(dev
):
1111 """P2P autonomous GO and VHT 80+80 MHz channel"""
1112 addr0
= dev
[0].p2p_dev_addr()
1115 set_country("US", dev
[0])
1116 if "OK" not in dev
[0].global_request("P2P_GROUP_ADD vht freq=5180 freq2=5775"):
1117 raise Exception("Could not start GO")
1118 ev
= dev
[0].wait_global_event(["P2P-GROUP-STARTED"], timeout
=5)
1120 raise Exception("GO start up timed out")
1121 dev
[0].group_form_result(ev
)
1123 pin
= dev
[1].wps_read_pin()
1124 dev
[0].p2p_go_authorize_client(pin
)
1126 dev
[1].global_request("P2P_CONNECT " + addr0
+ " " + pin
+ " join freq=5180")
1127 ev
= dev
[1].wait_global_event(["P2P-GROUP-STARTED"], timeout
=10)
1129 raise Exception("Peer did not get connected")
1131 dev
[1].group_form_result(ev
)
1132 sig
= dev
[1].group_request("SIGNAL_POLL").splitlines()
1133 if "FREQUENCY=5180" not in sig
:
1134 raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig
))
1135 if "WIDTH=80+80 MHz" not in sig
:
1136 raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig
))
1137 if "CENTER_FRQ1=5210" not in sig
:
1138 raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig
))
1139 if "CENTER_FRQ2=5775" not in sig
:
1140 raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig
))
1141 remove_group(dev
[0], dev
[1])
1144 dev
[1].flush_scan_cache()
1146 def test_p2p_channel_vht80_autogo(dev
):
1147 """P2P autonomous GO and VHT 80 MHz channel"""
1148 addr0
= dev
[0].p2p_dev_addr()
1151 set_country("US", dev
[0])
1152 if "OK" not in dev
[0].global_request("P2P_GROUP_ADD vht freq=5180 max_oper_chwidth=80"):
1153 raise Exception("Could not start GO")
1154 ev
= dev
[0].wait_global_event(["P2P-GROUP-STARTED"], timeout
=5)
1156 raise Exception("GO start up timed out")
1157 dev
[0].group_form_result(ev
)
1159 pin
= dev
[1].wps_read_pin()
1160 dev
[0].p2p_go_authorize_client(pin
)
1162 dev
[1].global_request("P2P_CONNECT " + addr0
+ " " + pin
+ " join freq=5180")
1163 ev
= dev
[1].wait_global_event(["P2P-GROUP-STARTED"], timeout
=10)
1165 raise Exception("Peer did not get connected")
1167 dev
[1].group_form_result(ev
)
1168 sig
= dev
[1].group_request("SIGNAL_POLL").splitlines()
1169 if "FREQUENCY=5180" not in sig
:
1170 raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig
))
1171 if "WIDTH=80 MHz" not in sig
:
1172 raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig
))
1173 remove_group(dev
[0], dev
[1])
1176 dev
[1].flush_scan_cache()
1178 def test_p2p_channel_vht80p80_persistent(dev
):
1179 """P2P persistent group re-invocation and VHT 80+80 MHz channel"""
1180 addr0
= dev
[0].p2p_dev_addr()
1181 form(dev
[0], dev
[1])
1184 set_country("US", dev
[0])
1185 invite(dev
[0], dev
[1], extra
="vht freq=5745 freq2=5210")
1186 [go_res
, cli_res
] = check_result(dev
[0], dev
[1])
1188 sig
= dev
[1].group_request("SIGNAL_POLL").splitlines()
1189 if "FREQUENCY=5745" not in sig
:
1190 raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig
))
1191 if "WIDTH=80+80 MHz" not in sig
:
1192 raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig
))
1193 if "CENTER_FRQ1=5775" not in sig
:
1194 raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig
))
1195 if "CENTER_FRQ2=5210" not in sig
:
1196 raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig
))
1197 remove_group(dev
[0], dev
[1])
1200 dev
[1].flush_scan_cache()