tests: P2P cross connection

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-12-10 01:59:47 +02:00
parent 42a697256e
commit 25057d9227
2 changed files with 41 additions and 2 deletions

View file

@ -22,6 +22,7 @@ from test_p2p_persistent import invite
def test_concurrent_autogo(dev, apdev):
"""Concurrent P2P autonomous GO"""
logger.info("Connect to an infrastructure AP")
dev[0].request("P2P_SET cross_connect 0")
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" })
dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412")
hwsim_utils.test_connectivity(dev[0], hapd)
@ -40,6 +41,43 @@ def test_concurrent_autogo(dev, apdev):
logger.info("Confirm AP connection after P2P group removal")
hwsim_utils.test_connectivity(dev[0], hapd)
def test_concurrent_autogo_crossconnect(dev, apdev):
"""Concurrent P2P autonomous GO"""
dev[0].request("P2P_SET cross_connect 1")
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" })
dev[0].connect("test-open", key_mgmt="NONE", scan_freq="2412")
dev[0].request("SET p2p_no_group_iface 0")
dev[0].p2p_start_go(no_event_clear=True)
ev = dev[0].wait_global_event("P2P-CROSS-CONNECT-ENABLE", timeout=10)
if ev is None:
raise Exception("Timeout on cross connection enabled event")
if dev[0].group_ifname + " " + dev[0].ifname not in ev:
raise Exception("Unexpected interfaces: " + ev)
dev[0].dump_monitor()
dev[0].request("P2P_SET cross_connect 0")
ev = dev[0].wait_global_event("P2P-CROSS-CONNECT-DISABLE", timeout=10)
if ev is None:
raise Exception("Timeout on cross connection disabled event")
if dev[0].group_ifname + " " + dev[0].ifname not in ev:
raise Exception("Unexpected interfaces: " + ev)
dev[0].remove_group()
dev[0].request("P2P_SET cross_connect 1")
dev[0].p2p_start_go(no_event_clear=True)
ev = dev[0].wait_global_event("P2P-CROSS-CONNECT-ENABLE", timeout=10)
if ev is None:
raise Exception("Timeout on cross connection enabled event")
if dev[0].group_ifname + " " + dev[0].ifname not in ev:
raise Exception("Unexpected interfaces: " + ev)
dev[0].dump_monitor()
dev[0].remove_group()
ev = dev[0].wait_global_event("P2P-CROSS-CONNECT-DISABLE", timeout=10)
if ev is None:
raise Exception("Timeout on cross connection disabled event")
dev[0].request("P2P_SET cross_connect 0")
def test_concurrent_p2pcli(dev, apdev):
"""Concurrent P2P client join"""
logger.info("Connect to an infrastructure AP")

View file

@ -660,7 +660,7 @@ class WpaSupplicant:
raise Exception("Group could not be removed")
self.group_ifname = None
def p2p_start_go(self, persistent=None, freq=None):
def p2p_start_go(self, persistent=None, freq=None, no_event_clear=False):
self.dump_monitor()
cmd = "P2P_GROUP_ADD"
if persistent is None:
@ -675,7 +675,8 @@ class WpaSupplicant:
ev = self.wait_global_event(["P2P-GROUP-STARTED"], timeout=5)
if ev is None:
raise Exception("GO start up timed out")
self.dump_monitor()
if not no_event_clear:
self.dump_monitor()
return self.group_form_result(ev)
raise Exception("P2P_GROUP_ADD failed")