From 55093c80149ff49a3874ecedf87ffc9df75445b7 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 11 Mar 2020 18:30:51 +0200 Subject: [PATCH] tests: Current Operating Class value from STA Verify Supported Operating Classes element contents from STA in various HT and VHT cases. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_ht.py | 19 +++++++++++++++++++ tests/hwsim/test_ap_vht.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index bb942bfff..c2b032c11 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -73,6 +73,18 @@ def test_ap_ht40_scan(dev, apdev): sta = hapd.get_sta(dev[0].own_addr()) logger.info("hostapd STA: " + str(sta)) + res = dev[0].request("SIGNAL_POLL") + logger.info("STA SIGNAL_POLL:\n" + res.strip()) + sig = res.splitlines() + if "WIDTH=40 MHz" not in sig: + raise Exception("Not a 40 MHz connection") + + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 84: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) + def test_ap_ht_wifi_generation(dev, apdev): """HT and wifi_generation""" clear_scan_cache(apdev[0]) @@ -892,6 +904,13 @@ def test_ap_require_ht(dev, apdev): ampdu_density="1", disable_ht40="1", disable_sgi="1", disable_ldpc="1", rx_stbc="2", tx_stbc="1") + sta = hapd.get_sta(dev[0].own_addr()) + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 81: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) + def test_ap_ht_stbc(dev, apdev): """HT STBC overrides""" params = {"ssid": "ht"} diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index ece0efda3..76257c79b 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -75,6 +75,11 @@ def test_ap_vht80(dev, apdev): raise Exception("Missing STA flag: HT") if "[VHT]" not in sta['flags']: raise Exception("Missing STA flag: VHT") + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 128: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) except Exception as e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not vht_supported(): @@ -290,6 +295,13 @@ def test_ap_vht_20(devs, apdevs): hapd = hostapd.add_ap(ap, params) dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE") hwsim_utils.test_connectivity(dev, hapd) + + sta = hapd.get_sta(dev.own_addr()) + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 115: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) finally: dev.request("DISCONNECT") clear_regdom(hapd, devs) @@ -313,6 +325,13 @@ def test_ap_vht_40(devs, apdevs): hapd = hostapd.add_ap(ap, params) dev.connect("test-vht40", scan_freq="5180", key_mgmt="NONE") hwsim_utils.test_connectivity(dev, hapd) + + sta = hapd.get_sta(dev.own_addr()) + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 116: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) finally: dev.request("DISCONNECT") clear_regdom(hapd, devs) @@ -395,6 +414,13 @@ def test_ap_vht160(dev, apdev): raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) if "WIDTH=160 MHz" not in sig: raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + + sta = hapd.get_sta(dev[0].own_addr()) + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 129: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) except Exception as e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not vht_supported(): @@ -644,6 +670,13 @@ def test_ap_vht80plus80(dev, apdev): raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig)) if "CENTER_FRQ2=5775" not in sig: raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig)) + + sta = hapd2.get_sta(dev[1].own_addr()) + if 'supp_op_classes' not in sta or len(sta['supp_op_classes']) < 2: + raise Exception("No Supported Operating Classes information for STA") + opclass = int(sta['supp_op_classes'][0:2], 16) + if opclass != 130: + raise Exception("Unexpected Current Operating Class from STA: %d" % opclass) except Exception as e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not vht_supported():