]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Replace HostapdGlobal() + remove() with hostapd.remove_bss()
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:25:12 +0000 (19:25 +0300)
This can be used to work with remote hosts.

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

index 8f1f4925a147b3c42523ba9464ca7735b06e650c..05e1ad126e318df0defdb6363ec8ff20d0f975f1 100644 (file)
@@ -18,8 +18,7 @@ def force_prev_ap_on_24g(ap):
     # sufficient survey data from mac80211_hwsim.
     hostapd.add_ap(ap, { "ssid": "open" })
     time.sleep(0.1)
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.remove(ap['ifname'])
+    hostapd.remove_bss(ap)
 
 def force_prev_ap_on_5g(ap):
     # For now, make sure the last operating channel was on 5 GHz band to get
@@ -27,8 +26,7 @@ def force_prev_ap_on_5g(ap):
     hostapd.add_ap(ap, { "ssid": "open", "hw_mode": "a",
                          "channel": "36", "country_code": "US" })
     time.sleep(0.1)
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.remove(ap['ifname'])
+    hostapd.remove_bss(ap)
 
 def wait_acs(hapd):
     ev = hapd.wait_event(["ACS-STARTED", "ACS-COMPLETED", "ACS-FAILED",
index 18ab5c2db624b9b6a6088273f313e2282d29c221..9bb5db90af4794f0004e2d9a54170f9ae401bed0 100644 (file)
@@ -8,43 +8,41 @@ import hostapd
 
 def test_ap_config_errors(dev, apdev):
     """Various hostapd configuration errors"""
-    hapd_global = hostapd.HostapdGlobal()
-    ifname = apdev[0]['ifname']
 
     # IEEE 802.11d without country code
     params = { "ssid": "foo", "ieee80211d": "1" }
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (ieee80211d without country_code)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # IEEE 802.11h without IEEE 802.11d
     params = { "ssid": "foo", "ieee80211h": "1" }
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (ieee80211h without ieee80211d")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # Power Constraint without IEEE 802.11d
     params = { "ssid": "foo", "local_pwr_constraint": "1" }
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (local_pwr_constraint without ieee80211d)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # Spectrum management without Power Constraint
     params = { "ssid": "foo", "spectrum_mgmt_required": "1" }
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (spectrum_mgmt_required without local_pwr_constraint)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # IEEE 802.1X without authentication server
     params = { "ssid": "foo", "ieee8021x": "1" }
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (ieee8021x)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # RADIUS-PSK without macaddr_acl=2
     params = hostapd.wpa2_params(ssid="foo", passphrase="12345678")
@@ -52,7 +50,7 @@ def test_ap_config_errors(dev, apdev):
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (wpa_psk_radius)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # FT without NAS-Identifier
     params = { "wpa": "2",
@@ -62,7 +60,7 @@ def test_ap_config_errors(dev, apdev):
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (FT without nas_identifier)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
     # Hotspot 2.0 without WPA2/CCMP
     params = hostapd.wpa2_params(ssid="foo")
@@ -77,4 +75,4 @@ def test_ap_config_errors(dev, apdev):
     hapd = hostapd.add_ap(apdev[0], params, no_enable=True)
     if "FAIL" not in hapd.request("ENABLE"):
         raise Exception("Unexpected ENABLE success (HS 2.0 without WPA2/CCMP)")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
index 993b5a7b775fa53d5e63e1c0b99c165d88342246..676fbda4efc44ed6c9ddd3266ab63bf9b8b0fcf0 100644 (file)
@@ -351,7 +351,6 @@ def test_ap_bss_add_many(dev, apdev):
 def _test_ap_bss_add_many(dev, apdev):
     ifname = apdev[0]['ifname']
     hostapd.add_bss(apdev[0], ifname, 'bss-1.conf')
-    hapd = hostapd.HostapdGlobal()
     fname = '/tmp/hwsim-bss.conf'
     for i in range(16):
         ifname2 = ifname + '-' + str(i)
@@ -376,7 +375,7 @@ def _test_ap_bss_add_many(dev, apdev):
         dev[0].request("DISCONNECT")
         dev[0].wait_disconnected(timeout=5)
         ifname2 = ifname + '-' + str(i)
-        hapd.remove(ifname2)
+        hostapd.remove_bss(apdev[0], ifname2)
 
 def test_ap_bss_add_reuse_existing(dev, apdev):
     """Dynamic BSS add operation reusing existing interface"""
index cd525787fa0cb99dec045196c0c4a9e982131360..20892181746e36029ec76b3b9e83d00bfbe8370f 100644 (file)
@@ -683,8 +683,7 @@ def test_olbc(dev, apdev):
     if status['olbc'] != '1' or status['olbc_ht'] != '1':
         raise Exception("Missing OLBC information")
 
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.remove(apdev[1]['ifname'])
+    hostapd.remove_bss(apdev[1])
 
     logger.info("Waiting for OLBC state to time out")
     cleared = False
index 1f714d985552576033d1a39dbcbcb2cfe8affe29..ab885d24595b21044413c97e447c6624cc8fad73 100644 (file)
@@ -13,7 +13,6 @@ from utils import HwsimSkip
 
 def hostapd_oom_loop(apdev, params, start_func="main"):
     hapd = hostapd.add_ap(apdev[0], { "ssid": "ctrl" })
-    hapd_global = hostapd.HostapdGlobal()
 
     count = 0
     for i in range(1, 1000):
@@ -22,7 +21,7 @@ def hostapd_oom_loop(apdev, params, start_func="main"):
         try:
             hostapd.add_ap(apdev[1], params, timeout=2.5)
             logger.info("Iteration %d - success" % i)
-            hapd_global.remove(apdev[1]['ifname'])
+            hostapd.remove_bss(apdev[1])
 
             state = hapd.request('GET_ALLOC_FAIL')
             logger.info("GET_ALLOC_FAIL: " + state)
index 8000dbb8e60561a0b4aa311255d00a9c65db0563..4de874a27ce95518a0fe9bf3f409ee1351c2596e 100644 (file)
@@ -605,9 +605,8 @@ def test_go_neg_two_peers(dev):
     if "status=5" not in ev:
         raise Exception("Unexpected status code in rejection: " + ev)
 
-def clear_pbc_overlap(dev, ifname):
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.remove(ifname)
+def clear_pbc_overlap(dev, ap):
+    hostapd.remove_bss(ap)
     dev[0].request("P2P_CANCEL")
     dev[1].request("P2P_CANCEL")
     dev[0].p2p_stop_find()
@@ -654,7 +653,7 @@ def test_grpform_pbc_overlap(dev, apdev):
     if ev is None:
         raise Exception("PBC overlap not reported")
 
-    clear_pbc_overlap(dev, apdev[0]['ifname'])
+    clear_pbc_overlap(dev, apdev[0])
 
 def test_grpform_pbc_overlap_group_iface(dev, apdev):
     """P2P group formation during PBC overlap using group interfaces"""
@@ -692,7 +691,7 @@ def test_grpform_pbc_overlap_group_iface(dev, apdev):
         # the group interface.
         logger.info("PBC overlap not reported")
 
-    clear_pbc_overlap(dev, apdev[0]['ifname'])
+    clear_pbc_overlap(dev, apdev[0])
 
 def test_grpform_goneg_fail_with_group_iface(dev):
     """P2P group formation fails while using group interface"""