From 81ea400d371020b3d05ac490e1ecd267fefd02e2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 21 Oct 2014 12:08:47 +0300 Subject: [PATCH] tests: P2P SD with GO Signed-off-by: Jouni Malinen --- tests/hwsim/test_p2p_service.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/hwsim/test_p2p_service.py b/tests/hwsim/test_p2p_service.py index 4497dbea3..4fdcb2a0b 100644 --- a/tests/hwsim/test_p2p_service.py +++ b/tests/hwsim/test_p2p_service.py @@ -249,3 +249,34 @@ def test_p2p_service_discovery_req_cancel(dev): query = dev[0].request("P2P_SERV_DISC_REQ 00:00:00:00:00:00 02000001") if "OK" not in dev[0].request("P2P_SERV_DISC_CANCEL_REQ " + query): raise Exception("Unexpected SD(broadcast) cancel failure") + +def test_p2p_service_discovery_go(dev): + """P2P service discovery from GO""" + addr0 = dev[0].p2p_dev_addr() + addr1 = dev[1].p2p_dev_addr() + + add_bonjour_services(dev[0]) + add_upnp_services(dev[0]) + + dev[0].p2p_start_go(freq=2412) + + dev[1].request("P2P_FLUSH") + dev[1].request("P2P_SERV_DISC_REQ " + addr0 + " 02000001") + if not dev[1].discover_peer(addr0, social=True, force_find=True): + raise Exception("Peer " + addr0 + " not found") + + ev = dev[0].wait_event(["P2P-SERV-DISC-REQ"], timeout=10) + if ev is None: + raise Exception("Service discovery timed out") + if addr1 not in ev: + raise Exception("Unexpected service discovery request source") + + ev = dev[1].wait_event(["P2P-SERV-DISC-RESP"], timeout=10) + if ev is None: + raise Exception("Service discovery timed out") + if addr0 not in ev: + raise Exception("Unexpected service discovery response source") + if "0b5f6166706f766572746370c00c000c01" not in ev: + raise Exception("Unexpected service discovery response contents (Bonjour)") + if "496e7465726e6574" not in ev: + raise Exception("Unexpected service discovery response contents (UPnP)")