tests: Move external_sim reset to test cases that change this

This removes unnecessary reset() step from between every test case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2014-11-28 16:13:06 +02:00 committed by Jouni Malinen
parent a0559aa5ba
commit 47dcb1186f
3 changed files with 40 additions and 11 deletions

View file

@ -247,6 +247,12 @@ def test_ap_wpa2_eap_sim_config(dev, apdev):
def test_ap_wpa2_eap_sim_ext(dev, apdev): def test_ap_wpa2_eap_sim_ext(dev, apdev):
"""WPA2-Enterprise connection using EAP-SIM and external GSM auth""" """WPA2-Enterprise connection using EAP-SIM and external GSM auth"""
try:
return _test_ap_wpa2_eap_sim_ext(dev, apdev)
finally:
dev[0].request("SET external_sim 0")
def _test_ap_wpa2_eap_sim_ext(dev, apdev):
if not os.path.exists("/tmp/hlr_auc_gw.sock"): if not os.path.exists("/tmp/hlr_auc_gw.sock"):
logger.info("No hlr_auc_gw available"); logger.info("No hlr_auc_gw available");
return "skip" return "skip"
@ -498,6 +504,12 @@ def test_ap_wpa2_eap_aka_config(dev, apdev):
def test_ap_wpa2_eap_aka_ext(dev, apdev): def test_ap_wpa2_eap_aka_ext(dev, apdev):
"""WPA2-Enterprise connection using EAP-AKA and external UMTS auth""" """WPA2-Enterprise connection using EAP-AKA and external UMTS auth"""
try:
return _test_ap_wpa2_eap_aka_ext(dev, apdev)
finally:
dev[0].request("SET external_sim 0")
def _test_ap_wpa2_eap_aka_ext(dev, apdev):
if not os.path.exists("/tmp/hlr_auc_gw.sock"): if not os.path.exists("/tmp/hlr_auc_gw.sock"):
logger.info("No hlr_auc_gw available"); logger.info("No hlr_auc_gw available");
return "skip" return "skip"

View file

@ -399,11 +399,14 @@ def test_ap_hs20_ext_sim(dev, apdev):
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].hs20_enable() dev[0].hs20_enable()
try:
dev[0].request("SET external_sim 1") dev[0].request("SET external_sim 1")
dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM" }) dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM" })
interworking_select(dev[0], "home", freq="2412") interworking_select(dev[0], "home", freq="2412")
interworking_ext_sim_connect(dev[0], bssid, "SIM") interworking_ext_sim_connect(dev[0], bssid, "SIM")
check_sp_type(dev[0], "home") check_sp_type(dev[0], "home")
finally:
dev[0].request("SET external_sim 0")
def test_ap_hs20_ext_sim_roaming(dev, apdev): def test_ap_hs20_ext_sim_roaming(dev, apdev):
"""Hotspot 2.0 with external SIM processing in roaming network""" """Hotspot 2.0 with external SIM processing in roaming network"""
@ -417,11 +420,14 @@ def test_ap_hs20_ext_sim_roaming(dev, apdev):
hostapd.add_ap(apdev[0]['ifname'], params) hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].hs20_enable() dev[0].hs20_enable()
try:
dev[0].request("SET external_sim 1") dev[0].request("SET external_sim 1")
dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM" }) dev[0].add_cred_values({ 'imsi': "23201-0000000000", 'eap': "SIM" })
interworking_select(dev[0], "roaming", freq="2412") interworking_select(dev[0], "roaming", freq="2412")
interworking_ext_sim_connect(dev[0], bssid, "SIM") interworking_ext_sim_connect(dev[0], bssid, "SIM")
check_sp_type(dev[0], "roaming") check_sp_type(dev[0], "roaming")
finally:
dev[0].request("SET external_sim 0")
def test_ap_hs20_username(dev, apdev): def test_ap_hs20_username(dev, apdev):
"""Hotspot 2.0 connection in username/password credential""" """Hotspot 2.0 connection in username/password credential"""
@ -1215,6 +1221,12 @@ def test_ap_hs20_max_bss_load2(dev, apdev):
def test_ap_hs20_multi_cred_sp_prio(dev, apdev): def test_ap_hs20_multi_cred_sp_prio(dev, apdev):
"""Hotspot 2.0 multi-cred sp_priority""" """Hotspot 2.0 multi-cred sp_priority"""
try:
return _test_ap_hs20_multi_cred_sp_prio(dev, apdev)
finally:
dev[0].request("SET external_sim 0")
def _test_ap_hs20_multi_cred_sp_prio(dev, apdev):
if not hlr_auc_gw_available(): if not hlr_auc_gw_available():
return "skip" return "skip"
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']
@ -1252,6 +1264,12 @@ def test_ap_hs20_multi_cred_sp_prio(dev, apdev):
def test_ap_hs20_multi_cred_sp_prio2(dev, apdev): def test_ap_hs20_multi_cred_sp_prio2(dev, apdev):
"""Hotspot 2.0 multi-cred sp_priority with two BSSes""" """Hotspot 2.0 multi-cred sp_priority with two BSSes"""
try:
return _test_ap_hs20_multi_cred_sp_prio2(dev, apdev)
finally:
dev[0].request("SET external_sim 0")
def _test_ap_hs20_multi_cred_sp_prio2(dev, apdev):
if not hlr_auc_gw_available(): if not hlr_auc_gw_available():
return "skip" return "skip"
bssid = apdev[0]['bssid'] bssid = apdev[0]['bssid']

View file

@ -93,7 +93,6 @@ class WpaSupplicant:
logger.info("FLUSH to " + self.ifname + " failed: " + res) logger.info("FLUSH to " + self.ifname + " failed: " + res)
self.request("WPS_ER_STOP") self.request("WPS_ER_STOP")
self.request("SET pmf 0") self.request("SET pmf 0")
self.request("SET external_sim 0")
self.request("SET hessid 00:00:00:00:00:00") self.request("SET hessid 00:00:00:00:00:00")
self.request("SET access_network_type 15") self.request("SET access_network_type 15")
self.request("SET p2p_add_cli_chan 0") self.request("SET p2p_add_cli_chan 0")