tests: Disable and re-enable hostapd interface
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py
index e8b5c18..7ed517b 100644
--- a/tests/hwsim/test_ap_open.py
+++ b/tests/hwsim/test_ap_open.py
@@ -416,3 +416,16 @@
res = dev[0].request("BLACKLIST")
if bssid1 in res or bssid2 in res:
raise Exception("Unexpected blacklist entry(2)")
+
+def test_ap_open_disable_enable(dev, apdev):
+ """AP with open mode getting disabled and re-enabled"""
+ hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "open" })
+ dev[0].connect("open", key_mgmt="NONE", scan_freq="2412",
+ bg_scan_period="0")
+
+ for i in range(2):
+ hapd.request("DISABLE")
+ dev[0].wait_disconnected()
+ hapd.request("ENABLE")
+ dev[0].wait_connected()
+ hwsim_utils.test_connectivity(dev[0], hapd)
diff --git a/tests/hwsim/test_ap_psk.py b/tests/hwsim/test_ap_psk.py
index cc21026..850bc6e 100644
--- a/tests/hwsim/test_ap_psk.py
+++ b/tests/hwsim/test_ap_psk.py
@@ -1844,3 +1844,20 @@
# optimized to prevent EAPOL-Key frame encryption for retransmission
# case, this exception can be uncommented here.
#raise Exception("Unexpected disconnection")
+
+def test_ap_wpa2_psk_disable_enable(dev, apdev):
+ """WPA2-PSK AP getting disabled and re-enabled"""
+ ssid = "test-wpa2-psk"
+ passphrase = 'qwertyuiop'
+ psk = '602e323e077bc63bd80307ef4745b754b0ae0a925c2638ecd13a794b9527b9e6'
+ params = hostapd.wpa2_params(ssid=ssid)
+ params['wpa_psk'] = psk
+ hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+ dev[0].connect(ssid, raw_psk=psk, scan_freq="2412")
+
+ for i in range(2):
+ hapd.request("DISABLE")
+ dev[0].wait_disconnected()
+ hapd.request("ENABLE")
+ dev[0].wait_connected()
+ hwsim_utils.test_connectivity(dev[0], hapd)