aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJanusz Dziedzic <janusz.dziedzic@tieto.com>2016-04-07 05:38:05 (GMT)
committerJouni Malinen <j@w1.fi>2016-04-24 16:25:12 (GMT)
commit1728a2e73c8342738a56540b1f44c1f6ce4a5f39 (patch)
treeb0b08eeb99827cb14bb9f47959f03142db7db0b1 /tests
parentb29c46beb92df6d58113de95aaaa16374a05d590 (diff)
downloadhostap-1728a2e73c8342738a56540b1f44c1f6ce4a5f39.zip
hostap-1728a2e73c8342738a56540b1f44c1f6ce4a5f39.tar.gz
hostap-1728a2e73c8342738a56540b1f44c1f6ce4a5f39.tar.bz2
tests: Replace HostapdGlobal() + remove() with hostapd.remove_bss()
This can be used to work with remote hosts. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hwsim/test_ap_acs.py6
-rw-r--r--tests/hwsim/test_ap_config.py18
-rw-r--r--tests/hwsim/test_ap_dynamic.py3
-rw-r--r--tests/hwsim/test_ap_ht.py3
-rw-r--r--tests/hwsim/test_hostapd_oom.py3
-rw-r--r--tests/hwsim/test_p2p_grpform.py9
6 files changed, 17 insertions, 25 deletions
diff --git a/tests/hwsim/test_ap_acs.py b/tests/hwsim/test_ap_acs.py
index 8f1f492..05e1ad1 100644
--- a/tests/hwsim/test_ap_acs.py
+++ b/tests/hwsim/test_ap_acs.py
@@ -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",
diff --git a/tests/hwsim/test_ap_config.py b/tests/hwsim/test_ap_config.py
index 18ab5c2..9bb5db9 100644
--- a/tests/hwsim/test_ap_config.py
+++ b/tests/hwsim/test_ap_config.py
@@ -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])
diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index 993b5a7..676fbda 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -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"""
diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py
index cd52578..2089218 100644
--- a/tests/hwsim/test_ap_ht.py
+++ b/tests/hwsim/test_ap_ht.py
@@ -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
diff --git a/tests/hwsim/test_hostapd_oom.py b/tests/hwsim/test_hostapd_oom.py
index 1f714d9..ab885d2 100644
--- a/tests/hwsim/test_hostapd_oom.py
+++ b/tests/hwsim/test_hostapd_oom.py
@@ -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)
diff --git a/tests/hwsim/test_p2p_grpform.py b/tests/hwsim/test_p2p_grpform.py
index 8000dbb..4de874a 100644
--- a/tests/hwsim/test_p2p_grpform.py
+++ b/tests/hwsim/test_p2p_grpform.py
@@ -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"""