From 99fdc0413b5ad58ab9219a131f8c56fec3212ba0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 2 Feb 2020 22:47:33 +0200 Subject: [PATCH] tests: WMM IE contents in FCC and ETSI Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_ht.py | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index 14c53666f..dc4c5b9d7 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -1523,3 +1523,67 @@ def test_ap_ht40_disable(dev, apdev): logger.info("SIGNAL_POLL: " + str(sig)) if "WIDTH=20 MHz" not in sig: raise Exception("Station did not report 20 MHz bandwidth") + +def test_ap_ht_wmm_etsi(dev, apdev): + """HT and WMM contents in ETSI""" + run_ap_ht_wmm(dev, apdev, "FI") + +def test_ap_ht_wmm_fcc(dev, apdev): + """HT and WMM contents in FCC""" + run_ap_ht_wmm(dev, apdev, "US") + +def run_ap_ht_wmm(dev, apdev, country): + clear_scan_cache(apdev[0]) + try: + hapd = None + params = {"ssid": "test", + "hw_mode": "a", + "channel": "36", + "country_code": country} + hapd = hostapd.add_ap(apdev[0], params) + freq = hapd.get_status_field("freq") + bssid = hapd.own_addr() + dev[0].connect("test", key_mgmt="NONE", scan_freq=freq) + bss = dev[0].get_bss(bssid) + ie = parse_ie(bss['ie']) + if 221 not in ie: + raise Exception("Could not find WMM IE") + wmm = ie[221] + if len(wmm) != 24: + raise Exception("Unexpected WMM IE length") + id, subtype, version, info, reserved = struct.unpack('>LBBBB', wmm[0:8]) + if id != 0x0050f202 or subtype != 1 or version != 1: + raise Exception("Not a WMM IE") + ac = [] + for i in range(4): + ac.append(struct.unpack('> 4, (ac[1][1] & 0xf0) >> 4, + (ac[2][1] & 0xf0) >> 4, (ac[3][1] & 0xf0) >> 4) + logger.info("ECW max: " + str(ecw_max)) + if ecw_max != (10, 10, 4, 3): + raise Exception("Unexpected ECW max value: " + str(ecw_max)) + + txop = (ac[0][2], ac[1][2], ac[2][2], ac[3][2]) + logger.info("TXOP: " + str(txop)) + if txop != (0, 0, 94, 47): + raise Exception("Unexpected TXOP value: " + str(txop)) + finally: + dev[0].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + set_world_reg(apdev[0], None, dev[0]) + dev[0].flush_scan_cache()