[PATCH 41/42] tests: Add test to verify link removal

Andrei Otcheretianski andrei.otcheretianski at intel.com
Mon Nov 20 15:51:55 PST 2023


From: Ilan Peer <ilan.peer at intel.com>

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/hostapd.py  |  4 ++++
 tests/hwsim/test_eht.py | 44 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
index b93d5caed5..ed9378bdc5 100644
--- a/tests/hwsim/hostapd.py
+++ b/tests/hwsim/hostapd.py
@@ -266,6 +266,10 @@ class Hostapd:
         if "OK" not in self.request("DISABLE"):
             raise Exception("Failed to disable hostapd interface " + self.ifname)
 
+    def link_remove(self, count=10):
+        if "OK" not in self.request("LINK_REMOVE %u" % count):
+            raise Exception("Failed to remove hostapd link " + self.ifname)
+
     def dump_monitor(self):
         while self.mon.pending():
             ev = self.mon.recv()
diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index 44149543b3..a92d9e5475 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -93,8 +93,8 @@ def eht_verify_status(wpas, hapd, freq, bw, is_ht=False, is_vht=False,
     time.sleep(0.1)
     _eht_verify_links(wpas, valid_links, active_links)
 
-def traffic_test(wpas, hapd):
-    hwsim_utils.test_connectivity(wpas, hapd)
+def traffic_test(wpas, hapd, success=True):
+    hwsim_utils.test_connectivity(wpas, hapd, success_expected=success)
 
 def test_eht_open(dev, apdev):
     """EHT AP with open mode configuration"""
@@ -823,3 +823,43 @@ def test_eht_connect_invalid_link(dev, apdev, params):
                          display=['frame.number'])
         if not out.splitlines():
             raise Exception('Association request send by mac80211 had unexpected ML element content (probably it contained a second link)')
+
+def test_eht_mld_link_removal(dev, apdev):
+    """EHT MLD with two links. Links removed during association"""
+
+    with HWSimRadio(use_mlo=True) as (hapd0_radio, hapd0_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_owe_two_link"
+        params = eht_mld_ap_wpa2_params(ssid, key_mgmt="OWE", mfp="2")
+        hapd0 = eht_mld_enable_ap(hapd0_iface, params)
+
+        params['channel'] = '6'
+        hapd1 = eht_mld_enable_ap(hapd0_iface, params)
+
+        wpas.connect(ssid, scan_freq="2412 2437", key_mgmt="OWE", 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("Disable the 2nd link in 4 beacon intervals")
+        hapd1.link_remove(4)
+        time.sleep(0.6)
+
+        logger.info("Test traffic after 2nd link disabled")
+        traffic_test(wpas, hapd0)
+
+        logger.info("Disable the 1st link in 20 beacon intervals")
+        hapd0.link_remove(20)
+        time.sleep(1)
+
+        logger.info("Verify that traffic is valid before the link is removed")
+        traffic_test(wpas, hapd0)
+        time.sleep(2)
+
+        logger.info("Test traffic after 1st link disabled")
+        traffic_test(wpas, hapd0, success=False)
-- 
2.38.1




More information about the Hostap mailing list