tests: Pass full apdev to add_ap() function (4)

Pass the full apdev to the add_ap() function instead of just ifname.
This allows us to handle also remote hosts while we can check
apdev['hostname'], apdev['port'].

This step (4) converts the cases that call hostapd.add_ap() from a
helper function that got apdev[i] as an argument.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
Janusz Dziedzic 2016-03-30 10:55:56 +02:00 committed by Jouni Malinen
parent 5eee514de9
commit afc26df29c
14 changed files with 22 additions and 22 deletions

View file

@ -16,7 +16,7 @@ from test_ap_ht import clear_scan_cache
def force_prev_ap_on_24g(ap):
# For now, make sure the last operating channel was on 2.4 GHz band to get
# sufficient survey data from mac80211_hwsim.
hostapd.add_ap(ap['ifname'], { "ssid": "open" })
hostapd.add_ap(ap, { "ssid": "open" })
time.sleep(0.1)
hapd_global = hostapd.HostapdGlobal()
hapd_global.remove(ap['ifname'])
@ -24,8 +24,8 @@ def force_prev_ap_on_24g(ap):
def force_prev_ap_on_5g(ap):
# For now, make sure the last operating channel was on 5 GHz band to get
# sufficient survey data from mac80211_hwsim.
hostapd.add_ap(ap['ifname'], { "ssid": "open", "hw_mode": "a",
"channel": "36", "country_code": "US" })
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'])

View file

@ -22,7 +22,7 @@ def check_cipher(dev, ap, cipher):
"wpa": "2",
"wpa_key_mgmt": "WPA-PSK",
"rsn_pairwise": cipher }
hapd = hostapd.add_ap(ap['ifname'], params)
hapd = hostapd.add_ap(ap, params)
dev.connect("test-wpa2-psk", psk="12345678",
pairwise=cipher, group=cipher, scan_freq="2412")
hwsim_utils.test_connectivity(dev, hapd)
@ -41,7 +41,7 @@ def check_group_mgmt_cipher(dev, ap, cipher):
"wpa_key_mgmt": "WPA-PSK-SHA256",
"rsn_pairwise": "CCMP",
"group_mgmt_cipher": cipher }
hapd = hostapd.add_ap(ap['ifname'], params)
hapd = hostapd.add_ap(ap, params)
dev.connect("test-wpa2-psk-pmf", psk="12345678", ieee80211w="2",
key_mgmt="WPA-PSK-SHA256",
pairwise="CCMP", group="CCMP", scan_freq="2412")

View file

@ -412,7 +412,7 @@ def hs20_simulated_sim(dev, ap, method):
params['hessid'] = bssid
params['anqp_3gpp_cell_net'] = "555,444"
params['domain_name'] = "wlan.mnc444.mcc555.3gppnetwork.org"
hostapd.add_ap(ap['ifname'], params)
hostapd.add_ap(ap, params)
dev.hs20_enable()
dev.add_cred_values({ 'imsi': "555444-333222111", 'eap': method,
@ -628,7 +628,7 @@ def eap_test(dev, ap, eap_params, method, user):
bssid = ap['bssid']
params = hs20_ap_params()
params['nai_realm'] = [ "0,example.com," + eap_params ]
hostapd.add_ap(ap['ifname'], params)
hostapd.add_ap(ap, params)
dev.hs20_enable()
dev.add_cred_values({ 'realm': "example.com",

View file

@ -191,7 +191,7 @@ def hapd_out_of_mem(hapd, apdev, count, func):
with alloc_fail(hapd, count, func):
started = False
try:
hostapd.add_ap(apdev['ifname'], { "ssid": "open" })
hostapd.add_ap(apdev, { "ssid": "open" })
started = True
except:
pass

View file

@ -694,7 +694,7 @@ def eapol_test(apdev, dev, wpa2=True):
else:
params = hostapd.wpa_params(ssid=ssid)
params['wpa_psk'] = psk
hapd = hostapd.add_ap(apdev['ifname'], params)
hapd = hostapd.add_ap(apdev, params)
hapd.request("SET ext_eapol_frame_io 1")
dev.request("SET ext_eapol_frame_io 1")
dev.connect(ssid, raw_psk=psk, scan_freq="2412", wait_connect=False)

View file

@ -75,7 +75,7 @@ def vht80_test(apdev, dev, channel, ht_capab):
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "42" }
hapd = hostapd.add_ap(apdev['ifname'], params)
hapd = hostapd.add_ap(apdev, params)
bssid = apdev['bssid']
dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
@ -225,7 +225,7 @@ def test_ap_vht_20(devs, apdevs):
"supported_rates": "60 120 240 360 480 540",
"require_vht": "1",
}
hapd = hostapd.add_ap(ap['ifname'], params)
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
finally:
@ -252,7 +252,7 @@ def test_ap_vht_40(devs, apdevs):
"vht_oper_chwidth": "0",
"vht_oper_centr_freq_seg0_idx": "0",
}
hapd = hostapd.add_ap(ap['ifname'], params)
hapd = hostapd.add_ap(ap, params)
dev.connect("test-vht40", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
finally:

View file

@ -36,7 +36,7 @@ def wps_start_ap(apdev, ssid="test-wps-conf"):
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP" }
return hostapd.add_ap(apdev['ifname'], params)
return hostapd.add_ap(apdev, params)
def test_ap_wps_init(dev, apdev):
"""Initial AP configuration with first WPS Enrollee"""
@ -5253,7 +5253,7 @@ def wps_start_ext(apdev, dev, pbc=False, pin=None):
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"}
hapd = hostapd.add_ap(apdev['ifname'], params)
hapd = hostapd.add_ap(apdev, params)
if pbc:
hapd.request("WPS_PBC")
@ -7656,7 +7656,7 @@ def wps_start_ext_reg(apdev, dev):
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
"ap_pin": appin }
hapd = hostapd.add_ap(apdev['ifname'], params)
hapd = hostapd.add_ap(apdev, params)
dev.scan_for_bss(bssid, freq="2412")
hapd.request("SET ext_eapol_frame_io 1")

View file

@ -99,7 +99,7 @@ def start_ap(ap, ssid="test-wps",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",
"ap_pin": "12345670", "uuid": ap_uuid}
return hostapd.add_ap(ap['ifname'], params)
return hostapd.add_ap(ap, params)
def test_dbus_getall(dev, apdev):
"""D-Bus GetAll"""

View file

@ -123,7 +123,7 @@ def start_erp_as(apdev):
"eap_fast_a_id_info": "test server",
"eap_server_erp": "1",
"erp_domain": "example.com" }
hostapd.add_ap(apdev['ifname'], params)
hostapd.add_ap(apdev, params)
def test_erp_radius(dev, apdev):
"""ERP enabled on RADIUS server and peer"""

View file

@ -52,7 +52,7 @@ def hs20_ap_params():
def start_ap(ap):
params = hs20_ap_params()
params['hessid'] = ap['bssid']
hostapd.add_ap(ap['ifname'], params)
hostapd.add_ap(ap, params)
return hostapd.Hostapd(ap['ifname'])
def get_gas_response(dev, bssid, info, allow_fetch_failure=False,

View file

@ -392,7 +392,7 @@ def test_nfc_wps_handover_pk_hash_mismatch_ap(dev, apdev):
def start_ap_er(er, ap, ssid):
ap_pin = "12345670"
ap_uuid = "27ea801a-9e5c-4e73-bd82-f89cbcd10d7e"
hostapd.add_ap(ap['ifname'],
hostapd.add_ap(ap,
{ "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP",

View file

@ -608,7 +608,7 @@ def sae_reflection_attack(apdev, dev, group):
params = hostapd.wpa2_params(ssid="test-sae",
passphrase="no-knowledge-of-passphrase")
params['wpa_key_mgmt'] = 'SAE'
hapd = hostapd.add_ap(apdev['ifname'], params)
hapd = hostapd.add_ap(apdev, params)
bssid = apdev['bssid']
dev.scan_for_bss(bssid, freq=2412)

View file

@ -721,7 +721,7 @@ def start_wnm_tm(ap, country, dev):
"hw_mode": "g",
"channel": "1",
"bss_transition": "1" }
hapd = hostapd.add_ap(ap['ifname'], params)
hapd = hostapd.add_ap(ap, params)
id = dev.connect("test-wnm", key_mgmt="NONE", scan_freq="2412")
dev.dump_monitor()
dev.set_network(id, "scan_freq", "")

View file

@ -20,7 +20,7 @@ def add_wmm_ap(apdev, acm_list):
for ac in acm_list:
params["wmm_ac_%s_acm" % (ac.lower())] = "1"
return hostapd.add_ap(apdev['ifname'], params)
return hostapd.add_ap(apdev, params)
def test_tspec(dev, apdev):
"""Basic addts/delts tests"""