diff mbox series

[5/6] tests: add HE BSS color change test

Message ID 20240422124005.3075001-6-quic_adisi@quicinc.com
State Accepted
Headers show
Series Add HE BSS color change support via cli | expand

Commit Message

Aditya Kumar Singh April 22, 2024, 12:40 p.m. UTC
Add he_bss_color_change test case which brings up a HE AP and performs
color change operation and validates the same via status cli.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
 tests/hwsim/test_he.py | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
diff mbox series

Patch

diff --git a/tests/hwsim/test_he.py b/tests/hwsim/test_he.py
index 544fa2e7b3d6..ce572f111e7c 100644
--- a/tests/hwsim/test_he.py
+++ b/tests/hwsim/test_he.py
@@ -1797,3 +1797,45 @@  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")
+
+    # Small sleep to capture beacons before the change
+    time.sleep(0.5)
+
+    # Change color by doing CCA
+    hapd.request("COLOR_CHANGE 20")
+    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
+    hapd.request("COLOR_CHANGE 0")
+    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 %d" % color)
+
+    # Enable color back by setting same previous color value
+    hapd.request("COLOR_CHANGE 20")
+    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")