From bd6bb3e37b3bf4eb373e8ba91ecde6389823b1b0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 15 Apr 2014 17:42:40 +0300 Subject: [PATCH] tests: HT 20/40 co-ex functionality during BSS lifetime 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 --- tests/hwsim/test_ap_ht.py | 78 ++++++++++++++++++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 3 +- 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index 05854ccdf..28fca8fc8 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -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") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 18c2c62c8..8733cae90 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -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])