Browse Source

tests: Verify hostapd ENABLE/DISABLE/ENABLE

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 11 years ago
parent
commit
00f74dbdb6
2 changed files with 30 additions and 1 deletions
  1. 1 1
      tests/hwsim/hostapd.py
  2. 29 0
      tests/hwsim/test_ap_dynamic.py

+ 1 - 1
tests/hwsim/hostapd.py

@@ -113,7 +113,7 @@ class Hostapd:
             raise Exception("Failed to enable hostapd interface " + self.ifname)
             raise Exception("Failed to enable hostapd interface " + self.ifname)
 
 
     def disable(self):
     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)
             raise Exception("Failed to disable hostapd interface " + self.ifname)
 
 
     def dump_monitor(self):
     def dump_monitor(self):

+ 29 - 0
tests/hwsim/test_ap_dynamic.py

@@ -285,3 +285,32 @@ def test_ap_remove_during_ht_coex_scan3(dev, apdev):
     hapd.set("ssid", "test-ht-remove2")
     hapd.set("ssid", "test-ht-remove2")
     hapd.enable()
     hapd.enable()
     hapd_global.remove(ifname2)
     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")