tests: Modify test_p2p_discovery to use global and group interfaces

Modify the tests in test_p2p_discovery to use the global
control interface and group interface.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
Ilan Peer 2015-02-05 20:30:59 -05:00 committed by Jouni Malinen
parent da749dc579
commit 4ef05faf43

View file

@ -99,7 +99,7 @@ def test_discovery_pd_retries(dev):
dev[1].p2p_stop_find()
dev[0].p2p_stop_find()
dev[0].global_request("P2P_PROV_DISC " + addr1 + " display")
ev = dev[0].wait_event(["P2P-PROV-DISC-FAILURE"], timeout=60)
ev = dev[0].wait_global_event(["P2P-PROV-DISC-FAILURE"], timeout=60)
if ev is None:
raise Exception("No PD failure reported")
@ -132,19 +132,22 @@ def test_discovery_group_client(dev):
# make group client non-responsive on operating channel
dev[1].dump_monitor()
dev[1].group_request("DISCONNECT")
dev[1].wait_disconnected(timeout=10)
ev = dev[1].wait_group_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
if ev is None:
raise Exception("Timeout on waiting disconnection")
dev[2].request("P2P_CONNECT {} {} display".format(dev[1].p2p_dev_addr(),
pin))
ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"], timeout=2)
ev = dev[1].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=2)
if ev:
raise Exception("Unexpected frame RX on P2P client")
# make group client available on operating channe
dev[1].request("REASSOCIATE")
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED", "P2P-GO-NEG-REQUEST"])
dev[1].group_request("REASSOCIATE")
ev = dev[1].wait_global_event(["CTRL-EVENT-CONNECTED",
"P2P-GO-NEG-REQUEST"], timeout=10)
if ev is None:
raise Exception("Timeout on reconnection to group")
if "P2P-GO-NEG-REQUEST" not in ev:
ev = dev[1].wait_event(["P2P-GO-NEG-REQUEST"])
ev = dev[1].wait_global_event(["P2P-GO-NEG-REQUEST"], timeout=10)
if ev is None:
raise Exception("Timeout on waiting for GO Negotiation Request")
@ -153,11 +156,11 @@ def test_discovery_dev_type(dev):
dev[1].request("SET sec_device_type 1-0050F204-2")
dev[1].p2p_listen()
dev[0].p2p_find(social=True, dev_type="5-0050F204-1")
ev = dev[0].wait_event(['P2P-DEVICE-FOUND'], timeout=1)
ev = dev[0].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1)
if ev:
raise Exception("Unexpected P2P device found")
dev[0].p2p_find(social=True, dev_type="1-0050F204-2")
ev = dev[0].wait_event(['P2P-DEVICE-FOUND'], timeout=2)
ev = dev[0].wait_global_event(['P2P-DEVICE-FOUND'], timeout=2)
if ev is None:
raise Exception("P2P device not found")
peer = dev[0].get_peer(dev[1].p2p_dev_addr())
@ -174,11 +177,11 @@ def test_discovery_dev_type_go(dev):
dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
dev[2].p2p_find(social=True, dev_type="5-0050F204-1")
ev = dev[2].wait_event(['P2P-DEVICE-FOUND'], timeout=1)
ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1)
if ev:
raise Exception("Unexpected P2P device found")
dev[2].p2p_find(social=True, dev_type="1-0050F204-2")
ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
if ev is None:
raise Exception("P2P device not found")
@ -220,11 +223,11 @@ def test_discovery_dev_id_go(dev):
dev[1].p2p_connect_group(dev[0].p2p_dev_addr(), pin, timeout=60)
dev[2].p2p_find(social=True, dev_id="02:03:04:05:06:07")
ev = dev[2].wait_event(['P2P-DEVICE-FOUND'], timeout=1)
ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND'], timeout=1)
if ev:
raise Exception("Unexpected P2P device found")
dev[2].p2p_find(social=True, dev_id=addr1)
ev = dev[2].wait_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
ev = dev[2].wait_global_event(['P2P-DEVICE-FOUND ' + addr1], timeout=2)
if ev is None:
raise Exception("P2P device not found")