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):
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")