tests: Verify hostapd WPS_GET_STATUS command
authorJouni Malinen <j@w1.fi>
Sun, 29 Dec 2013 15:49:21 +0000 (17:49 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Dec 2013 15:49:21 +0000 (17:49 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/test_ap_wps.py

index a0631ee..b1fa989 100644 (file)
@@ -22,6 +22,8 @@ def test_ap_wps_init(dev, apdev):
     hapd = hostapd.Hostapd(apdev[0]['ifname'])
     logger.info("WPS provisioning step")
     hapd.request("WPS_PBC")
+    if "PBC Status: Active" not in hapd.request("WPS_GET_STATUS"):
+        raise Exception("PBC status not shown correctly")
     dev[0].request("SET ignore_old_scan_res 1")
     dev[0].dump_monitor()
     dev[0].request("WPS_PBC")
@@ -38,6 +40,14 @@ def test_ap_wps_init(dev, apdev):
     if status['key_mgmt'] != 'WPA2-PSK':
         raise Exception("Unexpected key_mgmt")
 
+    status = hapd.request("WPS_GET_STATUS")
+    if "PBC Status: Disabled" not in status:
+        raise Exception("PBC status not shown correctly")
+    if "Last WPS result: Success" not in status:
+        raise Exception("Last WPS result not shown correctly")
+    if "Peer Address: " + dev[0].p2p_interface_addr() not in status:
+        raise Exception("Peer address not shown correctly")
+
 def test_ap_wps_init_2ap_pbc(dev, apdev):
     """Initial two-radio AP configuration with first WPS PBC Enrollee"""
     ssid = "test-wps"
@@ -208,6 +218,10 @@ def test_ap_wps_incorrect_pin(dev, apdev):
     # if a scan was in progress, wait for it to complete before trying WPS again
     ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
 
+    status = hapd.request("WPS_GET_STATUS")
+    if "Last WPS result: Failed" not in status:
+        raise Exception("WPS failure result not shown correctly")
+
     logger.info("WPS provisioning attempt 2")
     hapd.request("WPS_PIN any 12345670")
     dev[0].dump_monitor()
@@ -439,6 +453,13 @@ def test_ap_wps_setup_locked(dev, apdev):
     if not ap_setup_locked:
         raise Exception("AP setup was not locked")
 
+    hapd = hostapd.Hostapd(apdev[0]['ifname'])
+    status = hapd.request("WPS_GET_STATUS")
+    if "Last WPS result: Failed" not in status:
+        raise Exception("WPS failure result not shown correctly")
+    if "Peer Address: " + dev[0].p2p_interface_addr() not in status:
+        raise Exception("Peer address not shown correctly")
+
     time.sleep(0.5)
     dev[0].dump_monitor()
     logger.info("WPS provisioning step")