tests: AP tracking STA taxonomy
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 21 Sep 2016 18:22:58 +0000 (21:22 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 21 Sep 2016 21:45:24 +0000 (00:45 +0300)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/example-hostapd.config
tests/hwsim/test_ap_track.py

index 674386a..036c16c 100644 (file)
@@ -103,3 +103,4 @@ CONFIG_SUITEB=y
 CONFIG_MBO=y
 
 CONFIG_IAPP=y
+CONFIG_TAXONOMY=y
index 4262b85..64ca843 100644 (file)
@@ -283,3 +283,107 @@ def _test_ap_track_sta_force_2ghz(dev, apdev):
     if freq != '2437':
         raise Exception("Unexpected operating channel")
     dev[0].request("DISCONNECT")
+
+def test_ap_track_taxonomy(dev, apdev):
+    """AP tracking STA taxonomy"""
+    try:
+        _test_ap_track_taxonomy(dev, apdev)
+    finally:
+        dev[1].request("SET p2p_disabled 0")
+
+def _test_ap_track_taxonomy(dev, apdev):
+    params = { "ssid": "track",
+               "country_code": "US",
+               "hw_mode": "g",
+               "channel": "6",
+               "track_sta_max_num": "2" }
+    hapd = hostapd.add_ap(apdev[0], params)
+    bssid = apdev[0]['bssid']
+
+    dev[0].scan_for_bss(bssid, freq=2437, force_scan=True)
+    addr0 = dev[0].own_addr()
+    dev[0].connect("track", key_mgmt="NONE", scan_freq="2437")
+
+    dev[1].request("SET p2p_disabled 1")
+    dev[1].scan_for_bss(bssid, freq=2437, force_scan=True)
+    addr1 = dev[1].own_addr()
+    dev[1].connect("track", key_mgmt="NONE", scan_freq="2437")
+
+    wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+    wpas.interface_add("wlan5")
+    wpas.request("SET model_name track test")
+    wpas.scan_for_bss(bssid, freq=2437, force_scan=True)
+    addr = wpas.own_addr()
+    wpas.connect("track", key_mgmt="NONE", scan_freq="2437")
+
+    if "FAIL" not in hapd.request("SIGNATURE abc"):
+        raise Exception("SIGNATURE failure not reported (1)")
+    if "FAIL" not in hapd.request("SIGNATURE 22:33:44:55:66:77"):
+        raise Exception("SIGNATURE failure not reported (2)")
+
+    res = hapd.request("SIGNATURE " + addr0)
+    logger.info("sta0: " + res)
+    if not res.startswith("wifi4|probe:"):
+        raise Exception("Unexpected SIGNATURE prefix")
+    if "|assoc:" not in res:
+        raise Exception("Missing assoc info in SIGNATURE")
+    if "wps:track_test" in res:
+        raise Exception("Unexpected WPS model name")
+
+    res = hapd.request("SIGNATURE " + addr1)
+    logger.info("sta1: " + res)
+    if not res.startswith("wifi4|probe:"):
+        raise Exception("Unexpected SIGNATURE prefix")
+    if "|assoc:" not in res:
+        raise Exception("Missing assoc info in SIGNATURE")
+    if "wps:" in res:
+        raise Exception("Unexpected WPS info");
+    if ",221(0050f2,4)," in res:
+        raise Exception("Unexpected WPS IE info");
+    if ",221(506f9a,9)," in res:
+        raise Exception("Unexpected P2P IE info");
+
+    res = hapd.request("SIGNATURE " + addr)
+    logger.info("sta: " + res)
+    if not res.startswith("wifi4|probe:"):
+        raise Exception("Unexpected SIGNATURE prefix")
+    if "|assoc:" not in res:
+        raise Exception("Missing assoc info in SIGNATURE")
+    if "wps:track_test" not in res:
+        raise Exception("Missing WPS model name")
+    if ",221(0050f2,4)," not in res:
+        raise Exception("Missing WPS IE info");
+    if ",221(506f9a,9)," not in res:
+        raise Exception("Missing P2P IE info");
+
+    addr2 = dev[2].own_addr()
+    res = hapd.request("SIGNATURE " + addr2)
+    if "FAIL" not in res:
+        raise Exception("Unexpected SIGNATURE success for sta2 (1)")
+
+    for i in range(10):
+        dev[2].request("SCAN freq=2437 passive=1")
+        ev = dev[2].wait_event(["CTRL-EVENT-SCAN-RESULTS"], timeout=10)
+        if ev is None:
+            raise Exception("Scan did not complete")
+        if dev[2].get_bss(bssid):
+            break
+
+    res = hapd.request("SIGNATURE " + addr2)
+    if "FAIL" not in res:
+        raise Exception("Unexpected SIGNATURE success for sta2 (2)")
+
+    dev[2].connect("track", key_mgmt="NONE", scan_freq="2437")
+
+    res = hapd.request("SIGNATURE " + addr2)
+    if "FAIL" not in res and len(res) > 0:
+        raise Exception("Unexpected SIGNATURE success for sta2 (3)")
+
+    dev[2].scan_for_bss(bssid, freq=2437, force_scan=True)
+
+    res = hapd.request("SIGNATURE " + addr2)
+    logger.info("sta2: " + res)
+    if not res.startswith("wifi4|probe:"):
+        raise Exception("Unexpected SIGNATURE prefix")
+    if "|assoc:" not in res:
+        raise Exception("Missing assoc info in SIGNATURE")