From 00f74dbdb6fb687d4281fe433ef618448ee98829 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 13 Mar 2014 20:41:54 +0200 Subject: [PATCH] tests: Verify hostapd ENABLE/DISABLE/ENABLE Signed-off-by: Jouni Malinen --- tests/hwsim/hostapd.py | 2 +- tests/hwsim/test_ap_dynamic.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 83f070401..ce40adcd2 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -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): diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py index 7da037615..9820580dc 100644 --- a/tests/hwsim/test_ap_dynamic.py +++ b/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.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")