tests: Add Hotspot 2.0 test cases for connecting with username
The test_ap_hs20_username* test cases verify that a username/password credential can be used for Hotspot 2.0 connection and that the network type is reported correctly. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
59f8a3c69d
commit
8fba2e5d42
2 changed files with 86 additions and 0 deletions
|
@ -23,5 +23,6 @@
|
||||||
"chap user" TTLS-CHAP "password" [2]
|
"chap user" TTLS-CHAP "password" [2]
|
||||||
"mschap user" TTLS-MSCHAP "password" [2]
|
"mschap user" TTLS-MSCHAP "password" [2]
|
||||||
"DOMAIN\mschapv2 user" TTLS-MSCHAPV2 hash:8846f7eaee8fb117ad06bdd830b7586c [2]
|
"DOMAIN\mschapv2 user" TTLS-MSCHAPV2 hash:8846f7eaee8fb117ad06bdd830b7586c [2]
|
||||||
|
"hs20-test" TTLS-MSCHAPV2 "password" [2]
|
||||||
|
|
||||||
"user" MSCHAPV2,MD5,GTC "password" [2]
|
"user" MSCHAPV2,MD5,GTC "password" [2]
|
||||||
|
|
|
@ -109,6 +109,19 @@ def interworking_ext_sim_connect(dev, bssid, method):
|
||||||
if ev is None:
|
if ev is None:
|
||||||
raise Exception("Connection timed out")
|
raise Exception("Connection timed out")
|
||||||
|
|
||||||
|
def interworking_connect(dev, bssid, method):
|
||||||
|
dev.request("INTERWORKING_CONNECT " + bssid)
|
||||||
|
|
||||||
|
ev = dev.wait_event(["CTRL-EVENT-EAP-METHOD"], timeout=15)
|
||||||
|
if ev is None:
|
||||||
|
raise Exception("Network connected timed out")
|
||||||
|
if "(" + method + ")" not in ev:
|
||||||
|
raise Exception("Unexpected EAP method selection")
|
||||||
|
|
||||||
|
ev = dev.wait_event(["CTRL-EVENT-CONNECTED"], timeout=15)
|
||||||
|
if ev is None:
|
||||||
|
raise Exception("Connection timed out")
|
||||||
|
|
||||||
def test_ap_hs20_select(dev, apdev):
|
def test_ap_hs20_select(dev, apdev):
|
||||||
"""Hotspot 2.0 network selection"""
|
"""Hotspot 2.0 network selection"""
|
||||||
bssid = apdev[0]['bssid']
|
bssid = apdev[0]['bssid']
|
||||||
|
@ -165,3 +178,75 @@ def test_ap_hs20_ext_sim_roaming(dev, apdev):
|
||||||
interworking_select(dev[0], "roaming")
|
interworking_select(dev[0], "roaming")
|
||||||
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")
|
||||||
|
|
||||||
|
def test_ap_hs20_username(dev, apdev):
|
||||||
|
"""Hotspot 2.0 connection in username/password credential"""
|
||||||
|
if not hlr_auc_gw_available():
|
||||||
|
return "skip"
|
||||||
|
bssid = apdev[0]['bssid']
|
||||||
|
params = hs20_ap_params()
|
||||||
|
params['hessid'] = bssid
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
|
||||||
|
dev[0].hs20_enable()
|
||||||
|
id = dev[0].add_cred_values(realm="example.com", username="hs20-test",
|
||||||
|
password="password", domain="example.com")
|
||||||
|
interworking_select(dev[0], bssid, "home")
|
||||||
|
interworking_connect(dev[0], bssid, "TTLS")
|
||||||
|
check_sp_type(dev[0], "home")
|
||||||
|
|
||||||
|
def test_ap_hs20_username_roaming(dev, apdev):
|
||||||
|
"""Hotspot 2.0 connection in username/password credential (roaming)"""
|
||||||
|
if not hlr_auc_gw_available():
|
||||||
|
return "skip"
|
||||||
|
bssid = apdev[0]['bssid']
|
||||||
|
params = hs20_ap_params()
|
||||||
|
params['nai_realm'] = [ "0,example.com,13[5:6],21[2:4][5:7]",
|
||||||
|
"0,roaming.example.com,21[2:4][5:7]",
|
||||||
|
"0,another.example.com" ]
|
||||||
|
params['domain_name'] = "another.example.com"
|
||||||
|
params['hessid'] = bssid
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
|
||||||
|
dev[0].hs20_enable()
|
||||||
|
id = dev[0].add_cred_values(realm="roaming.example.com",
|
||||||
|
username="hs20-test",
|
||||||
|
password="password", domain="example.com")
|
||||||
|
interworking_select(dev[0], bssid, "roaming")
|
||||||
|
interworking_connect(dev[0], bssid, "TTLS")
|
||||||
|
check_sp_type(dev[0], "roaming")
|
||||||
|
|
||||||
|
def test_ap_hs20_username_unknown(dev, apdev):
|
||||||
|
"""Hotspot 2.0 connection in username/password credential (no domain in cred)"""
|
||||||
|
if not hlr_auc_gw_available():
|
||||||
|
return "skip"
|
||||||
|
bssid = apdev[0]['bssid']
|
||||||
|
params = hs20_ap_params()
|
||||||
|
params['hessid'] = bssid
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
|
||||||
|
dev[0].hs20_enable()
|
||||||
|
id = dev[0].add_cred_values(realm="example.com",
|
||||||
|
username="hs20-test",
|
||||||
|
password="password")
|
||||||
|
interworking_select(dev[0], bssid, "unknown")
|
||||||
|
interworking_connect(dev[0], bssid, "TTLS")
|
||||||
|
check_sp_type(dev[0], "unknown")
|
||||||
|
|
||||||
|
def test_ap_hs20_username_unknown2(dev, apdev):
|
||||||
|
"""Hotspot 2.0 connection in username/password credential (no domain advertized)"""
|
||||||
|
if not hlr_auc_gw_available():
|
||||||
|
return "skip"
|
||||||
|
bssid = apdev[0]['bssid']
|
||||||
|
params = hs20_ap_params()
|
||||||
|
params['hessid'] = bssid
|
||||||
|
del params['domain_name']
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
|
||||||
|
dev[0].hs20_enable()
|
||||||
|
id = dev[0].add_cred_values(realm="example.com",
|
||||||
|
username="hs20-test",
|
||||||
|
password="password", domain="example.com")
|
||||||
|
interworking_select(dev[0], bssid, "unknown")
|
||||||
|
interworking_connect(dev[0], bssid, "TTLS")
|
||||||
|
check_sp_type(dev[0], "unknown")
|
||||||
|
|
Loading…
Reference in a new issue