diff mbox series

[6/6] tests: Add MLD tests for deauthentication and disassociation

Message ID 20231225174303.4066419-6-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series [1/6] AP: Unify code handling deauthentication/disassociation | expand

Commit Message

Andrei Otcheretianski Dec. 25, 2023, 5:43 p.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

Verifying that the station can successfully associate again
after being deauthenticated or disassociated.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 tests/hwsim/test_eht.py | 48 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
diff mbox series

Patch

diff --git a/tests/hwsim/test_eht.py b/tests/hwsim/test_eht.py
index e46f92d35f..0b48e89496 100644
--- a/tests/hwsim/test_eht.py
+++ b/tests/hwsim/test_eht.py
@@ -1308,3 +1308,51 @@  def test_eht_6ghz_320mhz_2(dev, apdev):
 def test_eht_6ghz_320mhz_3(dev, apdev):
     """EHT with 320 MHz channel width on 6 GHz center 31 primary 37"""
     _test_eht_6ghz(dev, apdev, 37, 137, 31)
+
+def _eht_mld_disconnect(dev, apdev, disassoc=True):
+    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)
+
+        if disassoc:
+            cmd = "DISASSOCIATE "
+        else:
+            cmd = "DEAUTHENTICATE "
+
+        cmd += wpas.own_addr()
+        for i in range(0, 3):
+            time.sleep(1)
+
+            if "OK" not in hapd0.request(cmd):
+                raise Exception("Failed to request: " + cmd)
+
+            wpas.wait_disconnected(timeout=1)
+            wpas.wait_connected(timeout=5)
+
+            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)
+
+def test_eht_mld_disassociate(dev, apdev):
+    """EHT MLD with two links. Disassociate and reconnect"""
+    _eht_mld_disconnect(dev, apdev, disassoc=True)
+
+def test_eht_mld_deauthenticate(dev, apdev):
+    """EHT MLD with two links. Deauthenticate and reconnect"""
+    _eht_mld_disconnect(dev, apdev, disassoc=False)