]> git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/test_p2p_grpform.py
tests: Remove unnecessary interpreter line from most python files
[thirdparty/hostap.git] / tests / hwsim / test_p2p_grpform.py
1 # P2P group formation test cases
2 # Copyright (c) 2013-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
7 import logging
8 logger = logging.getLogger()
9 import time
10 import threading
11 import Queue
12
13 import hwsim_utils
14 import utils
15
16 def check_grpform_results(i_res, r_res):
17 if i_res['result'] != 'success' or r_res['result'] != 'success':
18 raise Exception("Failed group formation")
19 if i_res['ssid'] != r_res['ssid']:
20 raise Exception("SSID mismatch")
21 if i_res['freq'] != r_res['freq']:
22 raise Exception("freq mismatch")
23 if 'go_neg_freq' in r_res and i_res['go_neg_freq'] != r_res['go_neg_freq']:
24 raise Exception("go_neg_freq mismatch")
25 if i_res['freq'] != i_res['go_neg_freq']:
26 raise Exception("freq/go_neg_freq mismatch")
27 if i_res['role'] != i_res['go_neg_role']:
28 raise Exception("role/go_neg_role mismatch")
29 if 'go_neg_role' in r_res and r_res['role'] != r_res['go_neg_role']:
30 raise Exception("role/go_neg_role mismatch")
31 if i_res['go_dev_addr'] != r_res['go_dev_addr']:
32 raise Exception("GO Device Address mismatch")
33
34 def go_neg_init(i_dev, r_dev, pin, i_method, i_intent, res):
35 logger.debug("Initiate GO Negotiation from i_dev")
36 try:
37 i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), pin, i_method, timeout=20, go_intent=i_intent)
38 logger.debug("i_res: " + str(i_res))
39 except Exception, e:
40 i_res = None
41 logger.info("go_neg_init thread caught an exception from p2p_go_neg_init: " + str(e))
42 res.put(i_res)
43
44 def go_neg_pin(i_dev, r_dev, i_intent=None, r_intent=None, i_method='enter', r_method='display'):
45 r_dev.p2p_listen()
46 i_dev.p2p_listen()
47 pin = r_dev.wps_read_pin()
48 logger.info("Start GO negotiation " + i_dev.ifname + " -> " + r_dev.ifname)
49 r_dev.dump_monitor()
50 res = Queue.Queue()
51 t = threading.Thread(target=go_neg_init, args=(i_dev, r_dev, pin, i_method, i_intent, res))
52 t.start()
53 logger.debug("Wait for GO Negotiation Request on r_dev")
54 ev = r_dev.wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=15)
55 if ev is None:
56 raise Exception("GO Negotiation timed out")
57 r_dev.dump_monitor()
58 logger.debug("Re-initiate GO Negotiation from r_dev")
59 r_res = r_dev.p2p_go_neg_init(i_dev.p2p_dev_addr(), pin, r_method, go_intent=r_intent, timeout=20)
60 logger.debug("r_res: " + str(r_res))
61 r_dev.dump_monitor()
62 t.join()
63 i_res = res.get()
64 if i_res is None:
65 raise Exception("go_neg_init thread failed")
66 logger.debug("i_res: " + str(i_res))
67 logger.info("Group formed")
68 hwsim_utils.test_connectivity_p2p(r_dev, i_dev)
69 i_dev.dump_monitor()
70 return [i_res, r_res]
71
72 def go_neg_pin_authorized(i_dev, r_dev, i_intent=None, r_intent=None, expect_failure=False, i_go_neg_status=None, i_method='enter', r_method='display', test_data=True, i_freq=None, r_freq=None):
73 r_dev.p2p_listen()
74 i_dev.p2p_listen()
75 pin = r_dev.wps_read_pin()
76 logger.info("Start GO negotiation " + i_dev.ifname + " -> " + r_dev.ifname)
77 r_dev.p2p_go_neg_auth(i_dev.p2p_dev_addr(), pin, r_method, go_intent=r_intent, freq=r_freq)
78 i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), pin, i_method, timeout=20, go_intent=i_intent, expect_failure=expect_failure, freq=i_freq)
79 r_res = r_dev.p2p_go_neg_auth_result(expect_failure=expect_failure)
80 logger.debug("i_res: " + str(i_res))
81 logger.debug("r_res: " + str(r_res))
82 r_dev.dump_monitor()
83 i_dev.dump_monitor()
84 if i_go_neg_status:
85 if i_res['result'] != 'go-neg-failed':
86 raise Exception("Expected GO Negotiation failure not reported")
87 if i_res['status'] != i_go_neg_status:
88 raise Exception("Expected GO Negotiation status not seen")
89 if expect_failure:
90 return
91 logger.info("Group formed")
92 if test_data:
93 hwsim_utils.test_connectivity_p2p(r_dev, i_dev)
94 return [i_res, r_res]
95
96 def go_neg_init_pbc(i_dev, r_dev, i_intent, res, freq):
97 logger.debug("Initiate GO Negotiation from i_dev")
98 try:
99 i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), None, "pbc",
100 timeout=20, go_intent=i_intent, freq=freq)
101 logger.debug("i_res: " + str(i_res))
102 except Exception, e:
103 i_res = None
104 logger.info("go_neg_init_pbc thread caught an exception from p2p_go_neg_init: " + str(e))
105 res.put(i_res)
106
107 def go_neg_pbc(i_dev, r_dev, i_intent=None, r_intent=None, i_freq=None, r_freq=None):
108 r_dev.p2p_find(social=True)
109 i_dev.p2p_find(social=True)
110 logger.info("Start GO negotiation " + i_dev.ifname + " -> " + r_dev.ifname)
111 r_dev.dump_monitor()
112 res = Queue.Queue()
113 t = threading.Thread(target=go_neg_init_pbc, args=(i_dev, r_dev, i_intent, res, i_freq))
114 t.start()
115 logger.debug("Wait for GO Negotiation Request on r_dev")
116 ev = r_dev.wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=15)
117 if ev is None:
118 raise Exception("GO Negotiation timed out")
119 r_dev.dump_monitor()
120 logger.debug("Re-initiate GO Negotiation from r_dev")
121 r_res = r_dev.p2p_go_neg_init(i_dev.p2p_dev_addr(), None, "pbc",
122 go_intent=r_intent, timeout=20, freq=r_freq)
123 logger.debug("r_res: " + str(r_res))
124 r_dev.dump_monitor()
125 t.join()
126 i_res = res.get()
127 if i_res is None:
128 raise Exception("go_neg_init_pbc thread failed")
129 logger.debug("i_res: " + str(i_res))
130 logger.info("Group formed")
131 hwsim_utils.test_connectivity_p2p(r_dev, i_dev)
132 i_dev.dump_monitor()
133 return [i_res, r_res]
134
135 def remove_group(dev1, dev2):
136 dev1.remove_group()
137 try:
138 dev2.remove_group()
139 except:
140 pass
141
142 def test_grpform(dev):
143 """P2P group formation using PIN and authorized connection (init -> GO)"""
144 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
145 r_dev=dev[1], r_intent=0)
146 check_grpform_results(i_res, r_res)
147 remove_group(dev[0], dev[1])
148
149 def test_grpform_a(dev):
150 """P2P group formation using PIN and authorized connection (init -> GO) (init: group iface)"""
151 dev[0].request("SET p2p_no_group_iface 0")
152 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
153 r_dev=dev[1], r_intent=0)
154 if "p2p-wlan" not in i_res['ifname']:
155 raise Exception("Unexpected group interface name")
156 check_grpform_results(i_res, r_res)
157 remove_group(dev[0], dev[1])
158 if i_res['ifname'] in utils.get_ifnames():
159 raise Exception("Group interface netdev was not removed")
160
161 def test_grpform_b(dev):
162 """P2P group formation using PIN and authorized connection (init -> GO) (resp: group iface)"""
163 dev[1].request("SET p2p_no_group_iface 0")
164 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
165 r_dev=dev[1], r_intent=0)
166 if "p2p-wlan" not in r_res['ifname']:
167 raise Exception("Unexpected group interface name")
168 check_grpform_results(i_res, r_res)
169 remove_group(dev[0], dev[1])
170 if r_res['ifname'] in utils.get_ifnames():
171 raise Exception("Group interface netdev was not removed")
172
173 def test_grpform_c(dev):
174 """P2P group formation using PIN and authorized connection (init -> GO) (group iface)"""
175 dev[0].request("SET p2p_no_group_iface 0")
176 dev[1].request("SET p2p_no_group_iface 0")
177 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
178 r_dev=dev[1], r_intent=0)
179 if "p2p-wlan" not in i_res['ifname']:
180 raise Exception("Unexpected group interface name")
181 if "p2p-wlan" not in r_res['ifname']:
182 raise Exception("Unexpected group interface name")
183 check_grpform_results(i_res, r_res)
184 remove_group(dev[0], dev[1])
185 if i_res['ifname'] in utils.get_ifnames():
186 raise Exception("Group interface netdev was not removed")
187 if r_res['ifname'] in utils.get_ifnames():
188 raise Exception("Group interface netdev was not removed")
189
190 def test_grpform2(dev):
191 """P2P group formation using PIN and authorized connection (resp -> GO)"""
192 go_neg_pin_authorized(i_dev=dev[0], i_intent=0, r_dev=dev[1], r_intent=15)
193 remove_group(dev[0], dev[1])
194
195 def test_grpform2_c(dev):
196 """P2P group formation using PIN and authorized connection (resp -> GO) (group iface)"""
197 dev[0].request("SET p2p_no_group_iface 0")
198 dev[1].request("SET p2p_no_group_iface 0")
199 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0, r_dev=dev[1], r_intent=15)
200 remove_group(dev[0], dev[1])
201 if i_res['ifname'] in utils.get_ifnames():
202 raise Exception("Group interface netdev was not removed")
203 if r_res['ifname'] in utils.get_ifnames():
204 raise Exception("Group interface netdev was not removed")
205
206 def test_grpform3(dev):
207 """P2P group formation using PIN and re-init GO Negotiation"""
208 go_neg_pin(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0)
209 remove_group(dev[0], dev[1])
210
211 def test_grpform3_c(dev):
212 """P2P group formation using PIN and re-init GO Negotiation (group iface)"""
213 dev[0].request("SET p2p_no_group_iface 0")
214 dev[1].request("SET p2p_no_group_iface 0")
215 [i_res, r_res] = go_neg_pin(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0)
216 remove_group(dev[0], dev[1])
217 if i_res['ifname'] in utils.get_ifnames():
218 raise Exception("Group interface netdev was not removed")
219 if r_res['ifname'] in utils.get_ifnames():
220 raise Exception("Group interface netdev was not removed")
221
222 def test_grpform_pbc(dev):
223 """P2P group formation using PBC and re-init GO Negotiation"""
224 [i_res, r_res] = go_neg_pbc(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0)
225 check_grpform_results(i_res, r_res)
226 if i_res['role'] != 'GO' or r_res['role'] != 'client':
227 raise Exception("Unexpected device roles")
228 remove_group(dev[0], dev[1])
229
230 def test_both_go_intent_15(dev):
231 """P2P GO Negotiation with both devices using GO intent 15"""
232 go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=15, expect_failure=True, i_go_neg_status=9)
233
234 def test_both_go_neg_display(dev):
235 """P2P GO Negotiation with both devices trying to display PIN"""
236 go_neg_pin_authorized(i_dev=dev[0], r_dev=dev[1], expect_failure=True, i_go_neg_status=10, i_method='display', r_method='display')
237
238 def test_both_go_neg_enter(dev):
239 """P2P GO Negotiation with both devices trying to enter PIN"""
240 go_neg_pin_authorized(i_dev=dev[0], r_dev=dev[1], expect_failure=True, i_go_neg_status=10, i_method='enter', r_method='enter')
241
242 def test_grpform_per_sta_psk(dev):
243 """P2P group formation with per-STA PSKs"""
244 dev[0].request("P2P_SET per_sta_psk 1")
245 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0)
246 check_grpform_results(i_res, r_res)
247
248 pin = dev[2].wps_read_pin()
249 dev[0].p2p_go_authorize_client(pin)
250 c_res = dev[2].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
251 check_grpform_results(i_res, c_res)
252
253 if r_res['psk'] == c_res['psk']:
254 raise Exception("Same PSK assigned for both clients")
255
256 hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
257
258 dev[0].remove_group()
259 dev[1].wait_go_ending_session()
260 dev[2].wait_go_ending_session()
261
262 def test_grpform_per_sta_psk_wps(dev):
263 """P2P group formation with per-STA PSKs with non-P2P WPS STA"""
264 dev[0].request("P2P_SET per_sta_psk 1")
265 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0)
266 check_grpform_results(i_res, r_res)
267
268 dev[0].p2p_go_authorize_client_pbc()
269 dev[2].request("WPS_PBC")
270 ev = dev[2].wait_event(["CTRL-EVENT-CONNECTED"], timeout=30)
271 if ev is None:
272 raise Exception("Association with the GO timed out")
273
274 hwsim_utils.test_connectivity_p2p_sta(dev[1], dev[2])
275
276 dev[0].remove_group()
277 dev[2].request("DISCONNECT")
278 dev[1].wait_go_ending_session()
279
280 def test_grpform_force_chan_go(dev):
281 """P2P group formation forced channel selection by GO"""
282 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
283 i_freq=2432,
284 r_dev=dev[1], r_intent=0,
285 test_data=False)
286 check_grpform_results(i_res, r_res)
287 if i_res['freq'] != "2432":
288 raise Exception("Unexpected channel - did not follow GO's forced channel")
289 remove_group(dev[0], dev[1])
290
291 def test_grpform_force_chan_cli(dev):
292 """P2P group formation forced channel selection by client"""
293 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
294 i_freq=2417,
295 r_dev=dev[1], r_intent=15,
296 test_data=False)
297 check_grpform_results(i_res, r_res)
298 if i_res['freq'] != "2417":
299 raise Exception("Unexpected channel - did not follow GO's forced channel")
300 remove_group(dev[0], dev[1])
301
302 def test_grpform_force_chan_conflict(dev):
303 """P2P group formation fails due to forced channel mismatch"""
304 go_neg_pin_authorized(i_dev=dev[0], i_intent=0, i_freq=2422,
305 r_dev=dev[1], r_intent=15, r_freq=2427,
306 expect_failure=True, i_go_neg_status=7)
307
308 def test_grpform_pref_chan_go(dev):
309 """P2P group formation preferred channel selection by GO"""
310 dev[0].request("SET p2p_pref_chan 81:7")
311 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
312 r_dev=dev[1], r_intent=0,
313 test_data=False)
314 check_grpform_results(i_res, r_res)
315 if i_res['freq'] != "2442":
316 raise Exception("Unexpected channel - did not follow GO's p2p_pref_chan")
317 remove_group(dev[0], dev[1])
318
319 def test_grpform_pref_chan_go_overridden(dev):
320 """P2P group formation preferred channel selection by GO overridden by client"""
321 dev[1].request("SET p2p_pref_chan 81:7")
322 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
323 i_freq=2422,
324 r_dev=dev[1], r_intent=15,
325 test_data=False)
326 check_grpform_results(i_res, r_res)
327 if i_res['freq'] != "2422":
328 raise Exception("Unexpected channel - did not follow client's forced channel")
329 remove_group(dev[0], dev[1])
330
331 def test_grpform_no_go_freq_forcing_chan(dev):
332 """P2P group formation with no-GO freq forcing channel"""
333 dev[1].request("SET p2p_no_go_freq 100-200,300,4000-6000")
334 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
335 r_dev=dev[1], r_intent=15,
336 test_data=False)
337 check_grpform_results(i_res, r_res)
338 if int(i_res['freq']) > 4000:
339 raise Exception("Unexpected channel - did not follow no-GO freq")
340 remove_group(dev[0], dev[1])
341
342 def test_grpform_no_go_freq_conflict(dev):
343 """P2P group formation fails due to no-GO range forced by client"""
344 dev[1].request("SET p2p_no_go_freq 2000-3000")
345 go_neg_pin_authorized(i_dev=dev[0], i_intent=0, i_freq=2422,
346 r_dev=dev[1], r_intent=15,
347 expect_failure=True, i_go_neg_status=7)
348
349 def test_grpform_no_5ghz_world_roaming(dev):
350 """P2P group formation with world roaming regulatory"""
351 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
352 r_dev=dev[1], r_intent=15,
353 test_data=False)
354 check_grpform_results(i_res, r_res)
355 if int(i_res['freq']) > 4000:
356 raise Exception("Unexpected channel - did not follow world roaming rules")
357 remove_group(dev[0], dev[1])
358
359 def test_grpform_no_5ghz_add_cli(dev):
360 """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1"""
361 dev[0].request("SET p2p_add_cli_chan 1")
362 dev[1].request("SET p2p_add_cli_chan 1")
363 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
364 r_dev=dev[1], r_intent=14,
365 test_data=False)
366 check_grpform_results(i_res, r_res)
367 if int(i_res['freq']) > 4000:
368 raise Exception("Unexpected channel - did not follow world roaming rules")
369 remove_group(dev[0], dev[1])
370
371 def test_grpform_no_5ghz_add_cli2(dev):
372 """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (reverse)"""
373 dev[0].request("SET p2p_add_cli_chan 1")
374 dev[1].request("SET p2p_add_cli_chan 1")
375 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=14,
376 r_dev=dev[1], r_intent=0,
377 test_data=False)
378 check_grpform_results(i_res, r_res)
379 if int(i_res['freq']) > 4000:
380 raise Exception("Unexpected channel - did not follow world roaming rules")
381 remove_group(dev[0], dev[1])
382
383 def test_grpform_no_5ghz_add_cli3(dev):
384 """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (intent 15)"""
385 dev[0].request("SET p2p_add_cli_chan 1")
386 dev[1].request("SET p2p_add_cli_chan 1")
387 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0,
388 r_dev=dev[1], r_intent=15,
389 test_data=False)
390 check_grpform_results(i_res, r_res)
391 if int(i_res['freq']) > 4000:
392 raise Exception("Unexpected channel - did not follow world roaming rules")
393 remove_group(dev[0], dev[1])
394
395 def test_grpform_no_5ghz_add_cli4(dev):
396 """P2P group formation with passive scan 5 GHz and p2p_add_cli_chan=1 (reverse; intent 15)"""
397 dev[0].request("SET p2p_add_cli_chan 1")
398 dev[1].request("SET p2p_add_cli_chan 1")
399 [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
400 r_dev=dev[1], r_intent=0,
401 test_data=False)
402 check_grpform_results(i_res, r_res)
403 if int(i_res['freq']) > 4000:
404 raise Exception("Unexpected channel - did not follow world roaming rules")
405 remove_group(dev[0], dev[1])
406
407 def test_grpform_incorrect_pin(dev):
408 """P2P GO Negotiation with incorrect PIN"""
409 dev[1].p2p_listen()
410 pin = dev[1].wps_read_pin()
411 addr1 = dev[1].p2p_dev_addr()
412 if not dev[0].discover_peer(addr1):
413 raise Exception("Peer not found")
414 dev[1].p2p_go_neg_auth(dev[0].p2p_dev_addr(), pin, 'display', go_intent=0)
415 dev[0].request("P2P_CONNECT " + addr1 + " 00000000 enter go_intent=15")
416 ev = dev[1].wait_event(["P2P-GROUP-FORMATION-FAILURE"], timeout=10)
417 if ev is None:
418 raise Exception("Group formation failure timed out")
419 ev = dev[0].wait_event(["P2P-GROUP-FORMATION-FAILURE"], timeout=5)
420 if ev is None:
421 raise Exception("Group formation failure timed out")
422
423 def test_grpform_reject(dev):
424 """User rejecting group formation attempt by a P2P peer"""
425 addr0 = dev[0].p2p_dev_addr()
426 dev[0].p2p_listen()
427 dev[1].p2p_go_neg_init(addr0, None, "pbc")
428 ev = dev[0].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=15)
429 if ev is None:
430 raise Exception("GO Negotiation timed out")
431 if "FAIL" in dev[0].global_request("P2P_REJECT " + ev.split(' ')[1]):
432 raise Exception("P2P_REJECT failed")
433 dev[1].request("P2P_STOP_FIND")
434 dev[1].p2p_go_neg_init(addr0, None, "pbc")
435 ev = dev[1].wait_global_event(["GO-NEG-FAILURE"], timeout=10)
436 if ev is None:
437 raise Exception("Rejection not reported")
438 if "status=11" not in ev:
439 raise Exception("Unexpected status code in rejection")
440
441 def test_grpform_pd_no_probe_resp(dev):
442 """GO Negotiation after PD, but no Probe Response"""
443 addr0 = dev[0].p2p_dev_addr()
444 addr1 = dev[1].p2p_dev_addr()
445 dev[0].p2p_listen()
446 if not dev[1].discover_peer(addr0):
447 raise Exception("Peer not found")
448 dev[1].p2p_stop_find()
449 dev[0].p2p_stop_find()
450 peer = dev[0].get_peer(addr1)
451 if peer['listen_freq'] == '0':
452 raise Exception("Peer listen frequency not learned from Probe Request")
453 time.sleep(0.3)
454 dev[0].request("P2P_FLUSH")
455 dev[0].p2p_listen()
456 dev[1].global_request("P2P_PROV_DISC " + addr0 + " display")
457 ev = dev[0].wait_global_event(["P2P-PROV-DISC-SHOW-PIN"], timeout=5)
458 if ev is None:
459 raise Exception("PD Request timed out")
460 ev = dev[1].wait_global_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=5)
461 if ev is None:
462 raise Exception("PD Response timed out")
463 peer = dev[0].get_peer(addr1)
464 if peer['listen_freq'] != '0':
465 raise Exception("Peer listen frequency learned unexpectedly from PD Request")
466
467 pin = dev[0].wps_read_pin()
468 if "FAIL" in dev[1].request("P2P_CONNECT " + addr0 + " " + pin + " enter"):
469 raise Exception("P2P_CONNECT on initiator failed")
470 ev = dev[0].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=5)
471 if ev is None:
472 raise Exception("GO Negotiation start timed out")
473 peer = dev[0].get_peer(addr1)
474 if peer['listen_freq'] == '0':
475 raise Exception("Peer listen frequency not learned from PD followed by GO Neg Req")
476 if "FAIL" in dev[0].request("P2P_CONNECT " + addr1 + " " + pin + " display"):
477 raise Exception("P2P_CONNECT on responder failed")
478 ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
479 if ev is None:
480 raise Exception("Group formation timed out")
481 ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
482 if ev is None:
483 raise Exception("Group formation timed out")