]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Verify hostapd ENABLE/DISABLE/ENABLE
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 13 Mar 2014 18:41:54 +0000 (20:41 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 13 Mar 2014 18:41:54 +0000 (20:41 +0200)
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/hostapd.py
tests/hwsim/test_ap_dynamic.py

index 83f070401df52583ce6f433150e2c803fbb13dc9..ce40adcd2c46d0695c207cfc57b53d5e17d7a249 100644 (file)
@@ -113,7 +113,7 @@ class Hostapd:
             raise Exception("Failed to enable hostapd interface " + self.ifname)
 
     def disable(self):
-        if not "OK" in self.request("ENABLE"):
+        if not "OK" in self.request("DISABLE"):
             raise Exception("Failed to disable hostapd interface " + self.ifname)
 
     def dump_monitor(self):
index 7da037615f98fcc1c05280143332192d94a8a185..9820580dcbfc79580e9bbec887e5f8005e16d0b7 100644 (file)
@@ -285,3 +285,32 @@ def test_ap_remove_during_ht_coex_scan3(dev, apdev):
     hapd.set("ssid", "test-ht-remove2")
     hapd.enable()
     hapd_global.remove(ifname2)
+
+def test_ap_enable_disable_reenable(dev, apdev):
+    """Enable, disable, re-enable AP"""
+    ifname = apdev[0]['ifname']
+    hapd_global = hostapd.HostapdGlobal()
+    hapd_global.add(ifname)
+    hapd = hostapd.Hostapd(ifname)
+    hapd.set_defaults()
+    hapd.set("ssid", "dynamic")
+    hapd.enable()
+    ev = hapd.wait_event(["AP-ENABLED"], timeout=30)
+    if ev is None:
+        raise Exception("AP startup timed out")
+    dev[0].connect("dynamic", key_mgmt="NONE", scan_freq="2412")
+    hapd.disable()
+    ev = hapd.wait_event(["AP-DISABLED"], timeout=30)
+    if ev is None:
+        raise Exception("AP disabling timed out")
+    ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"])
+    if ev is None:
+        raise Exception("STA disconnect event timed out")
+    hapd.enable()
+    ev = hapd.wait_event(["AP-ENABLED"], timeout=30)
+    if ev is None:
+        raise Exception("AP startup timed out")
+    dev[1].connect("dynamic", key_mgmt="NONE", scan_freq="2412")
+    ev = dev[0].wait_event(["CTRL-EVENT-CONNECTED"])
+    if ev is None:
+        raise Exception("STA connect event timed out")