diff mbox series

[7/7] tests: hwsim: Add test_ap_reload_bss_only

Message ID 20220801110827.237391-8-raphael.melotte@mind.be
State Accepted
Headers show
Series hostapd: add support for reconfiguring single BSSes | expand

Commit Message

Raphaël Mélotte Aug. 1, 2022, 11:08 a.m. UTC
The test checks that when the SSID of a BSS is changed using
SET+RELOAD_BSS, the stations already connected to other BSSes on the
same radio are not disconnected.

It also checks that stations can connect using the new SSID after the
reload.

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
 tests/hwsim/test_ap_dynamic.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index ad29eb71e..02133687e 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -584,3 +584,26 @@  def test_ap_bss_config_file(dev, apdev, params):
             break
     if os.path.exists(pidfile):
         raise Exception("PID file exits after process termination")
+
+def test_ap_reload_bss_only(dev, apdev, params):
+    """Dynamic SSID change on only one BSS using RELOAD_BSS"""
+    ifname1 = apdev[0]['ifname']
+    ifname2 = apdev[0]['ifname'] + '-2'
+    hapd1 = hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
+    hapd2 = hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
+    id = dev[0].connect("bss-1", key_mgmt="NONE", scan_freq="2412")
+    dev[1].connect("bss-2", key_mgmt="NONE", scan_freq="2412")
+
+    res = hapd1.request("SET ssid test-new-ssid")
+    if "OK" not in res:
+        raise Exception("SET command failed")
+    res = hapd1.request("RELOAD_BSS")
+    if "OK" not in res:
+        raise Exception("RELOAD_BSS command failed")
+
+    ev = dev[1].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=1)
+    if ev is not None:
+        raise Exception("Unexpected disconnection when RELOAD_BSS was sent on another BSS.")
+
+    dev[0].set_network_quoted(id, "ssid", "test-new-ssid")
+    dev[0].connect_network(id)