[PATCH v1 6/6] tests: hwsim: ap_dynamic: Added test case for VAP restart

oleksandr.savchenko at celeno.com oleksandr.savchenko at celeno.com
Thu Jul 14 09:53:06 PDT 2022


From: Viktor Barna <viktor.barna at celeno.com>

This test emulate `ifconfig down/up secondary bss`

run example:

sudo ./start.sh
sudo ./run-tests.py ap_multi_bss_restart
DEV: wlan0: 02:00:00:00:00:00
DEV: wlan1: 02:00:00:00:01:00
DEV: wlan2: 02:00:00:00:02:00
APDEV: wlan3
APDEV: wlan4
START ap_multi_bss_restart 1/1
Test: Multiple BSSes restart with hostapd
Starting BSS phy=phy3 ifname=wlan3
Starting BSS phy=phy3 ifname=wlan3-2
Connect STA wlan0 to AP
Connect STA wlan1 to AP
PASS ap_multi_bss_restart 0.665893 2022-07-11 16:42:48.622036
passed all 1 test case(s)

Signed-off-by: Viktor Barna <viktor.barna at celeno.com>
Signed-off-by: Alexander Savchenko <oleksandr.savchenko at celeno.com>
---
 tests/hwsim/test_ap_dynamic.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index ad29eb71e..57a089d61 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -497,6 +497,32 @@ def test_ap_multi_bss(dev, apdev):
     if 'rx_packets' not in sta1 or int(sta1['rx_packets']) < 1:
         raise Exception("sta1 did not report receiving packets")
 
+def test_ap_multi_bss_restart(dev, apdev):
+    """Multiple BSSes restart with hostapd"""
+    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')
+
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname1, 'down'])
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname1, 'up'])
+
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname2, 'down'])
+    hostapd.cmd_execute(apdev[0], ['ip', 'link', 'set', ifname2, 'up'])
+
+    dev[0].connect("bss-1", key_mgmt="NONE", scan_freq="2412")
+    dev[1].connect("bss-2", key_mgmt="NONE", scan_freq="2412")
+
+    hwsim_utils.test_connectivity(dev[0], hapd1)
+    hwsim_utils.test_connectivity(dev[1], hapd2)
+
+    sta0 = hapd1.get_sta(dev[0].own_addr())
+    sta1 = hapd2.get_sta(dev[1].own_addr())
+    if 'rx_packets' not in sta0 or int(sta0['rx_packets']) < 1:
+        raise Exception("sta0 did not report receiving packets")
+    if 'rx_packets' not in sta1 or int(sta1['rx_packets']) < 1:
+        raise Exception("sta1 did not report receiving packets")
+
 @remote_compatible
 def test_ap_add_with_driver(dev, apdev):
     """Add hostapd interface with driver specified"""
-- 
2.25.0




More information about the Hostap mailing list