From 72203b8fe33907b70bd575866296a25b7df2b144 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Singh Date: Mon, 22 Apr 2024 18:10:04 +0530 Subject: [PATCH] tests: Add HE BSS color change test Add the he_bss_color_change test case which brings up an HE AP and performs color change operations and validates the result. Signed-off-by: Aditya Kumar Singh --- tests/hwsim/test_he.py | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/tests/hwsim/test_he.py b/tests/hwsim/test_he.py index 544fa2e7b..825e23f0e 100644 --- a/tests/hwsim/test_he.py +++ b/tests/hwsim/test_he.py @@ -1797,3 +1797,50 @@ def run_he_downgrade_to_20_mhz(dev, apdev, params): finally: dev[0].request("DISCONNECT") clear_regdom(hapd, dev) + +def test_he_bss_color_change(dev, apdev): + """HE AP with color change""" + params = {"ssid": "test_he", + "ieee80211ax": "1", + "he_bss_color": "42", + "he_mu_edca_ac_be_ecwmin": "7", + "he_mu_edca_ac_be_ecwmax": "15"} + hapd = hostapd.add_ap(apdev[0], params) + if hapd.get_status_field("ieee80211ax") != "1": + raise Exception("STATUS did not indicate ieee80211ax=1") + + color = hapd.get_status_field("he_bss_color") + if color != "42": + raise Exception("Expected current he_bss_color to be 42; was " + color) + + # Small sleep to capture Beacon frames before the change + time.sleep(0.5) + + # Change color by doing CCA + if "OK" not in hapd.request("COLOR_CHANGE 20"): + raise Exception("COLOR_CHANGE failed") + time.sleep(1.5) + + color = hapd.get_status_field("he_bss_color") + if color != "20": + raise Exception("Expected current he_bss_color to be 20") + + # Disable color by setting value to 0 + if "OK" not in hapd.request("COLOR_CHANGE 0"): + raise Exception("COLOR_CHANGE failed") + time.sleep(1.5) + + color = hapd.get_status_field("he_bss_color") + if color is not None: + raise Exception("Expected he_bss_color to get disabled but found " + color) + + # Enable color back by setting same previous color value + if "OK" not in hapd.request("COLOR_CHANGE 20"): + raise Exception("COLOR_CHANGE failed") + time.sleep(1.5) + + color = hapd.get_status_field("he_bss_color") + if color != "20": + raise Exception("Expected current he_bss_color to be 20") + + hapd.dump_monitor()