diff mbox series

tests: Add basic MLO CSA test case

Message ID 20240308043508.14853-1-quic_adisi@quicinc.com
State Accepted
Headers show
Series tests: Add basic MLO CSA test case | expand

Commit Message

Aditya Kumar Singh March 8, 2024, 4:35 a.m. UTC
Verify that CSA can be performed on the first link of an AP MLD and further
check that traffic still continues even after channel switch.

Finally, check again that a subsequent CSA can be performed without
affecting the data traffic.

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


base-commit: eecaceed8f03cee676d47dd9fb70efd25d50e3e9

Comments

Jouni Malinen March 8, 2024, 9 a.m. UTC | #1
On Fri, Mar 08, 2024 at 10:05:08AM +0530, Aditya Kumar Singh wrote:
> Verify that CSA can be performed on the first link of an AP MLD and further
> check that traffic still continues even after channel switch.
> 
> Finally, check again that a subsequent CSA can be performed without
> affecting the data traffic.

Thanks, applied with wpa_supplicant event validation for CS added.
diff mbox series

Patch

diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index 1804c2250ca0..7fce52a6065d 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -1732,3 +1732,71 @@  def test_eht_mld_and_mlds(dev, apdev):
         logger.info("Assigned AIDs: " + str(aid))
         if len(set(aid)) != 2:
             raise Exception("AP MLD did not assign unique AID to each non-AP MLD")
+
+def mlo_perform_csa(hapd, command, freq):
+        match_str = "freq=" + str(freq)
+        hapd.request(command)
+
+        ev = hapd.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10)
+        if ev is None:
+            raise Exception("Channel switch start event not seen")
+        if match_str not in ev:
+            raise Exception("Unexpected channel in CS started")
+
+        ev = hapd.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10)
+        if ev is None:
+            raise Exception("Channel switch completion event not seen")
+        if match_str not in ev:
+            raise Exception("Unexpected channel in CS completed")
+
+        ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10)
+        if ev is None:
+            raise Exception("CSA finished event timed out")
+        if match_str not in ev:
+            raise Exception("Unexpected channel in CSA finished event")
+        time.sleep(0.5)
+
+def test_eht_mlo_csa(dev, apdev):
+        """EHT MLD AP connected to non-AP MLD. Seamless channel switch"""
+        csa_supported(dev[0])
+
+        with HWSimRadio(use_mlo=True) as (hapd_radio, hapd_iface), \
+            HWSimRadio(use_mlo=True) as (wpas_radio, wpas_iface):
+
+            wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+            wpas.interface_add(wpas_iface)
+
+            ssid = "mld_ap"
+            passphrase = 'qwertyuiop'
+
+            params = eht_mld_ap_wpa2_params(ssid, passphrase,
+                                            key_mgmt="SAE", mfp="2", pwe='1')
+            hapd0 = eht_mld_enable_ap(hapd_iface, params)
+
+            params['channel'] = '6'
+            hapd1 = eht_mld_enable_ap(hapd_iface, params)
+
+            wpas.set("sae_pwe", "1")
+            wpas.connect(ssid, sae_password=passphrase, scan_freq="2412 2437",
+                         key_mgmt="SAE", ieee80211w="2")
+
+            eht_verify_status(wpas, hapd0, 2412, 20, is_ht=True, mld=True,
+                              valid_links=3, active_links=3)
+            eht_verify_wifi_version(wpas)
+            traffic_test(wpas, hapd0)
+
+            logger.info("Perform CSA on 1st link")
+            mlo_perform_csa(hapd0, "CHAN_SWITCH 5 2462 ht he eht blocktx",
+                            2462)
+
+            logger.info("Test traffic after 1st link CSA completes")
+            traffic_test(wpas, hapd0)
+
+            logger.info("Perform CSA on 1st link and bring it back to original channel")
+            mlo_perform_csa(hapd0, "CHAN_SWITCH 5 2412 ht he eht blocktx",
+                            2412)
+
+            logger.info("Test traffic again after 1st link CSA completes")
+            traffic_test(wpas, hapd0)
+
+            #TODO: CSA on non-first link