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>
This commit is contained in:
parent
b29c46beb9
commit
1728a2e73c
6 changed files with 17 additions and 25 deletions
|
@ -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",
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in a new issue