]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: HT 20/40 co-ex functionality during BSS lifetime
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 15 Apr 2014 14:42:40 +0000 (17:42 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 29 Apr 2014 09:52:10 +0000 (12:52 +0300)
Verify that AP acts on 40 MHz intolerant STA association/disassociation
and on 20/40 co-ex report indicating 40 MHz intolerant AP showed up and
removed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_ap_ht.py
tests/hwsim/wpasupplicant.py

index 05854ccdf46799489c75ac9e15254da1516a6e73..28fca8fc8d15b813b4031384519d12cd97f36a6b 100644 (file)
@@ -462,3 +462,81 @@ def test_ap_ht_capab_not_supported(dev, apdev):
     hapd = hostapd.add_ap(apdev[0]['ifname'], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success")
+
+def test_ap_ht_40mhz_intolerant_sta(dev, apdev):
+    """Associated STA indicating 40 MHz intolerant"""
+    params = { "ssid": "intolerant",
+               "channel": "6",
+               "ht_capab": "[HT40-]" }
+    hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+    if hapd.get_status_field("num_sta_ht40_intolerant") != "0":
+        raise Exception("Unexpected num_sta_ht40_intolerant value")
+    if hapd.get_status_field("secondary_channel") != "-1":
+        raise Exception("Unexpected secondary_channel")
+
+    dev[0].connect("intolerant", key_mgmt="NONE", scan_freq="2437")
+    if hapd.get_status_field("num_sta_ht40_intolerant") != "0":
+        raise Exception("Unexpected num_sta_ht40_intolerant value")
+    if hapd.get_status_field("secondary_channel") != "-1":
+        raise Exception("Unexpected secondary_channel")
+
+    dev[2].connect("intolerant", key_mgmt="NONE", scan_freq="2437",
+                   ht40_intolerant="1")
+    time.sleep(1)
+    if hapd.get_status_field("num_sta_ht40_intolerant") != "1":
+        raise Exception("Unexpected num_sta_ht40_intolerant value (expected 1)")
+    if hapd.get_status_field("secondary_channel") != "0":
+        raise Exception("Unexpected secondary_channel (did not disable 40 MHz)")
+
+    dev[2].request("DISCONNECT")
+    time.sleep(1)
+    if hapd.get_status_field("num_sta_ht40_intolerant") != "0":
+        raise Exception("Unexpected num_sta_ht40_intolerant value (expected 0)")
+    if hapd.get_status_field("secondary_channel") != "-1":
+        raise Exception("Unexpected secondary_channel (did not re-enable 40 MHz)")
+
+def test_ap_ht_40mhz_intolerant_ap(dev, apdev):
+    """Associated STA reports 40 MHz intolerant AP after association"""
+    params = { "ssid": "ht",
+               "channel": "6",
+               "ht_capab": "[HT40-]",
+               "obss_interval": "1" }
+    hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+
+    dev[0].connect("ht", key_mgmt="NONE", scan_freq="2437")
+
+    if hapd.get_status_field("secondary_channel") != "-1":
+        raise Exception("Unexpected secondary channel information")
+
+    logger.info("Start 40 MHz intolerant AP")
+    params = { "ssid": "intolerant",
+               "channel": "5",
+               "ht_capab": "[40-INTOLERANT]" }
+    hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
+
+    logger.info("Waiting for co-ex report from STA")
+    ok = False
+    for i in range(0, 20):
+        time.sleep(1)
+        if hapd.get_status_field("secondary_channel") == "0":
+            logger.info("AP moved to 20 MHz channel")
+            ok = True
+            break
+    if not ok:
+        raise Exception("AP did not move to 20 MHz channel")
+
+    if "OK" not in hapd2.request("DISABLE"):
+        raise Exception("Failed to disable 40 MHz intolerant AP")
+
+    # make sure the intolerant AP disappears from scan results more quickly
+    dev[0].scan(only_new=True)
+    dev[0].scan(freq="2432", only_new=True)
+
+    logger.info("Waiting for AP to move back to 40 MHz channel")
+    ok = False
+    for i in range(0, 30):
+        time.sleep(1)
+        if hapd.get_status_field("secondary_channel") == "-1":
+            ok = True
+    if not ok:
+        raise Exception("AP did not move to 40 MHz channel")
index 18c2c62c80a20d298627a9a14309cb8637412c0c..8733cae9052acc02a265723073f961e7a7119f36 100644 (file)
@@ -658,7 +658,8 @@ class WpaSupplicant:
                        "eapol_flags", "fragment_size", "scan_ssid", "auth_alg",
                        "wpa_ptk_rekey", "disable_ht", "disable_vht", "bssid",
                        "disable_max_amsdu", "ampdu_factor", "ampdu_density",
-                       "disable_ht40", "disable_sgi", "disable_ldpc" ]
+                       "disable_ht40", "disable_sgi", "disable_ldpc",
+                       "ht40_intolerant" ]
         for field in not_quoted:
             if field in kwargs and kwargs[field]:
                 self.set_network(id, field, kwargs[field])