]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Remove HostapdGlobal() use from invalid_ap()
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>
Thu, 7 Apr 2016 05:38:05 +0000 (07:38 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 24 Apr 2016 16:24:44 +0000 (19:24 +0300)
Pass apdev to instead of HostapdGlobal() to invalid_ap() to make the
dynamic AP test cases more useful for testing with remove hosts.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
tests/hwsim/test_ap_dynamic.py

index d8f6e27a1110fa14476aec129e5a103137280a39..993b5a7b775fa53d5e63e1c0b99c165d88342246 100644 (file)
@@ -199,14 +199,9 @@ def test_ap_multi_bss_config(dev, apdev):
     hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
 
-def invalid_ap(hapd_global, ifname):
-    logger.info("Trying to start AP " + ifname + " with invalid configuration")
-    hapd_global.remove(ifname)
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    if not hapd.ping():
-        raise Exception("Could not ping hostapd")
-    hapd.set_defaults()
+def invalid_ap(ap):
+    logger.info("Trying to start AP " + ap['ifname'] + " with invalid configuration")
+    hapd = hostapd.add_ap(ap, {}, no_enable=True)
     hapd.set("ssid", "invalid-config")
     hapd.set("channel", "12345")
     try:
@@ -220,9 +215,7 @@ def invalid_ap(hapd_global, ifname):
 
 def test_ap_invalid_config(dev, apdev):
     """Try to start AP with invalid configuration and fix configuration"""
-    hapd_global = hostapd.HostapdGlobal()
-    ifname = apdev[0]['ifname']
-    hapd = invalid_ap(hapd_global, ifname)
+    hapd = invalid_ap(apdev[0])
 
     logger.info("Fix configuration and start AP again")
     hapd.set("channel", "1")
@@ -231,11 +224,9 @@ def test_ap_invalid_config(dev, apdev):
 
 def test_ap_invalid_config2(dev, apdev):
     """Try to start AP with invalid configuration and remove interface"""
-    hapd_global = hostapd.HostapdGlobal()
-    ifname = apdev[0]['ifname']
-    hapd = invalid_ap(hapd_global, ifname)
+    hapd = invalid_ap(apdev[0])
     logger.info("Remove interface with failed configuration")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
 def test_ap_remove_during_acs(dev, apdev):
     """Remove interface during ACS"""