[PATCH 7/7] tests: Use the global control interface in test_nfc_p2p.py (continued)

Ilan Peer ilan.peer at intel.com
Thu Feb 5 20:31:02 EST 2015


Signed-off-by: David Spinadel <david.spinadel at intel.com>
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_nfc_p2p.py | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/tests/hwsim/test_nfc_p2p.py b/tests/hwsim/test_nfc_p2p.py
index 3e601c8..5611449 100644
--- a/tests/hwsim/test_nfc_p2p.py
+++ b/tests/hwsim/test_nfc_p2p.py
@@ -556,7 +556,7 @@ def test_nfc_p2p_go_legacy_config_token(dev):
     logger.info("Start autonomous GOs")
     dev[0].p2p_start_go()
     logger.info("Connect legacy WPS STA with configuration token")
-    conf = dev[0].request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip()
+    conf = dev[0].group_request("WPS_NFC_CONFIG_TOKEN NDEF").rstrip()
     if "FAIL" in conf:
         raise Exception("Failed to generate configuration token")
     dev[1].dump_monitor()
@@ -576,10 +576,10 @@ def test_nfc_p2p_go_legacy_handover(dev):
     req = dev[1].request("NFC_GET_HANDOVER_REQ NDEF WPS-CR").rstrip()
     if "FAIL" in req:
         raise Exception("Failed to generate NFC connection handover request")
-    sel = dev[0].request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip()
+    sel = dev[0].group_request("NFC_GET_HANDOVER_SEL NDEF WPS-CR").rstrip()
     if "FAIL" in sel:
         raise Exception("Failed to generate NFC connection handover select")
-    res = dev[0].request("NFC_REPORT_HANDOVER RESP WPS " + req + " " + sel)
+    res = dev[0].group_request("NFC_REPORT_HANDOVER RESP WPS " + req + " " + sel)
     if "FAIL" in res:
         raise Exception("Failed to report NFC connection handover to wpa_supplicant (GO)")
     dev[1].dump_monitor()
@@ -594,24 +594,24 @@ def test_nfc_p2p_go_legacy_handover(dev):
 def test_nfc_p2p_ip_addr_assignment(dev):
     """NFC connection handover and legacy station IP address assignment"""
     set_ip_addr_info(dev[1])
-    dev[0].request("SET p2p_go_intent 3")
+    dev[0].global_request("SET p2p_go_intent 3")
     logger.info("Perform NFC connection handover")
-    req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip()
+    req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip()
     if "FAIL" in req:
         raise Exception("Failed to generate NFC connection handover request")
-    sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip()
+    sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip()
     if "FAIL" in sel:
         raise Exception("Failed to generate NFC connection handover select")
     dev[0].dump_monitor()
     dev[1].dump_monitor()
-    res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel)
+    res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel)
     if "FAIL" in res:
         raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)")
-    res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel)
+    res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel)
     if "FAIL" in res:
         raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)")
 
-    ev = dev[0].wait_event(["P2P-GROUP-STARTED",
+    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED",
                             "P2P-GO-NEG-FAILURE",
                             "P2P-GROUP-FORMATION-FAILURE",
                             "WPS-PIN-NEEDED"], timeout=15)
@@ -619,7 +619,7 @@ def test_nfc_p2p_ip_addr_assignment(dev):
         raise Exception("Group formation timed out")
     res0 = dev[0].group_form_result(ev)
 
-    ev = dev[1].wait_event(["P2P-GROUP-STARTED",
+    ev = dev[1].wait_global_event(["P2P-GROUP-STARTED",
                             "P2P-GO-NEG-FAILURE",
                             "P2P-GROUP-FORMATION-FAILURE",
                             "WPS-PIN-NEEDED"], timeout=1)
@@ -634,13 +634,14 @@ def test_nfc_p2p_ip_addr_assignment(dev):
     check_ip_addr(res0)
 
     logger.info("Connect legacy P2P client that does not use new IP address assignment")
-    res = dev[2].request("P2P_SET disable_ip_addr_req 1")
+    res = dev[2].global_request("P2P_SET disable_ip_addr_req 1")
     if "FAIL" in res:
         raise Exception("Failed to disable IP address assignment request")
     pin = dev[2].wps_read_pin()
     dev[1].p2p_go_authorize_client(pin)
     res = dev[2].p2p_connect_group(dev[1].p2p_dev_addr(), pin, timeout=60)
     logger.info("Client connected")
+    res = dev[2].global_request("P2P_SET disable_ip_addr_req 0")
     hwsim_utils.test_connectivity_p2p(dev[1], dev[2])
     if 'ip_addr' in res:
         raise Exception("Unexpected IP address assignment")
@@ -648,24 +649,24 @@ def test_nfc_p2p_ip_addr_assignment(dev):
 def test_nfc_p2p_ip_addr_assignment2(dev):
     """NFC connection handover and IP address assignment for two clients"""
     set_ip_addr_info(dev[1])
-    dev[0].request("SET p2p_go_intent 3")
+    dev[0].global_request("SET p2p_go_intent 3")
     logger.info("Perform NFC connection handover")
-    req = dev[0].request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip()
+    req = dev[0].global_request("NFC_GET_HANDOVER_REQ NDEF P2P-CR").rstrip()
     if "FAIL" in req:
         raise Exception("Failed to generate NFC connection handover request")
-    sel = dev[1].request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip()
+    sel = dev[1].global_request("NFC_GET_HANDOVER_SEL NDEF P2P-CR").rstrip()
     if "FAIL" in sel:
         raise Exception("Failed to generate NFC connection handover select")
     dev[0].dump_monitor()
     dev[1].dump_monitor()
-    res = dev[1].request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel)
+    res = dev[1].global_request("NFC_REPORT_HANDOVER RESP P2P " + req + " " + sel)
     if "FAIL" in res:
         raise Exception("Failed to report NFC connection handover to wpa_supplicant(resp)")
-    res = dev[0].request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel)
+    res = dev[0].global_request("NFC_REPORT_HANDOVER INIT P2P " + req + " " + sel)
     if "FAIL" in res:
         raise Exception("Failed to report NFC connection handover to wpa_supplicant(init)")
 
-    ev = dev[0].wait_event(["P2P-GROUP-STARTED",
+    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED",
                             "P2P-GO-NEG-FAILURE",
                             "P2P-GROUP-FORMATION-FAILURE",
                             "WPS-PIN-NEEDED"], timeout=15)
@@ -673,7 +674,7 @@ def test_nfc_p2p_ip_addr_assignment2(dev):
         raise Exception("Group formation timed out")
     res0 = dev[0].group_form_result(ev)
 
-    ev = dev[1].wait_event(["P2P-GROUP-STARTED",
+    ev = dev[1].wait_global_event(["P2P-GROUP-STARTED",
                             "P2P-GO-NEG-FAILURE",
                             "P2P-GROUP-FORMATION-FAILURE",
                             "WPS-PIN-NEEDED"], timeout=1)
-- 
1.8.3.2



More information about the HostAP mailing list