tests: Verify hostapd ENABLE/DISABLE/ENABLE

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-03-13 20:41:54 +02:00 committed by Jouni Malinen
parent 32b450fcee
commit 00f74dbdb6
2 changed files with 30 additions and 1 deletions

View file

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

View file

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