tests: New Passpoint Home OI parameters

Move testing to use the new Home OI parameters while maintaining a
couple of tests for the deprecated parameters.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
This commit is contained in:
Damien Dejean 2022-09-15 08:02:13 +00:00 committed by Jouni Malinen
parent 3268ec0acf
commit 5f89fffb76
5 changed files with 75 additions and 35 deletions

View file

@ -1101,6 +1101,32 @@ def test_ap_hs20_roaming_consortium(dev, apdev):
raise Exception("Timeout on already-connected event")
dev[0].remove_cred(id)
def test_ap_hs20_home_ois(dev, apdev):
"""Hotspot 2.0 connection based on roaming consortium match"""
bssid = apdev[0]['bssid']
params = hs20_ap_params()
params['hessid'] = bssid
hostapd.add_ap(apdev[0], params)
dev[0].flush_scan_cache()
dev[0].hs20_enable()
for consortium in [["112233"], ["1020304050"], ["010203040506"], ["fedcba"],
["f12233", "f020304050", "f10203040506", "fedcba"]]:
id = dev[0].add_cred_values({'username': "user",
'password': "password",
'domain': "example.com",
'ca_cert': "auth_serv/ca.pem",
'home_ois': consortium,
'eap': "PEAP"})
interworking_select(dev[0], bssid, "home", freq="2412")
interworking_connect(dev[0], bssid, "PEAP")
check_sp_type(dev[0], "home")
dev[0].request("INTERWORKING_SELECT auto freq=2412")
ev = dev[0].wait_event(["INTERWORKING-ALREADY-CONNECTED"], timeout=15)
if ev is None:
raise Exception("Timeout on already-connected event")
dev[0].remove_cred(id)
def test_ap_hs20_roaming_consortiums_match(dev, apdev):
"""Hotspot 2.0 connection based on roaming_consortiums match"""
bssid = apdev[0]['bssid']
@ -1159,7 +1185,7 @@ def test_ap_hs20_roaming_consortium_invalid(dev, apdev):
'password': "password",
'domain': "example.com",
'ca_cert': "auth_serv/ca.pem",
'roaming_consortium': "fedcba",
'home_ois': ["fedcba"],
'eap': "PEAP"})
interworking_select(dev[0], bssid, "home", freq="2412", no_match=True)
@ -1178,7 +1204,7 @@ def test_ap_hs20_roaming_consortium_element(dev, apdev):
'password': "password",
'domain': "example.com",
'ca_cert': "auth_serv/ca.pem",
'roaming_consortium': "112233",
'home_ois': ["112233"],
'eap': "PEAP"})
interworking_select(dev[0], bssid, freq="2412", no_match=True)
@ -1203,10 +1229,10 @@ def test_ap_hs20_roaming_consortium_constraints(dev, apdev):
'password': "password",
'domain': "example.com",
'ca_cert': "auth_serv/ca.pem",
'roaming_consortium': "fedcba",
'home_ois': ["fedcba"],
'eap': "TTLS"}
vals2 = vals.copy()
vals2['required_roaming_consortium'] = "223344"
vals2['required_home_ois'] = ["223344"]
id = dev[0].add_cred_values(vals2)
interworking_select(dev[0], bssid, "home", freq="2412", no_match=True)
dev[0].remove_cred(id)
@ -1247,16 +1273,16 @@ def test_ap_hs20_roaming_consortium_constraints(dev, apdev):
dev[0].remove_cred(id)
values = default_cred()
values['roaming_consortium'] = "fedcba"
values['home_ois'] = ["fedcba"]
id3 = dev[0].add_cred_values(values)
vals2 = vals.copy()
vals2['roaming_consortium'] = "fedcba"
vals2['home_ois'] = ["fedcba"]
vals2['priority'] = "2"
id = dev[0].add_cred_values(vals2)
values = default_cred()
values['roaming_consortium'] = "fedcba"
values['home_ois'] = ["fedcba"]
id2 = dev[0].add_cred_values(values)
dev[0].request("INTERWORKING_SELECT freq=2412")
@ -1283,7 +1309,7 @@ def test_ap_hs20_3gpp_constraints(dev, apdev):
'eap': "SIM",
'milenage': "5122250214c33e723a5dd523fc145fc0:981d464c7c52eb6e5036234984ad0bcf:000000000123"}
vals2 = vals.copy()
vals2['required_roaming_consortium'] = "223344"
vals2['required_home_ois'] = ["223344"]
id = dev[0].add_cred_values(vals2)
interworking_select(dev[0], bssid, "home", freq="2412", no_match=True)
dev[0].remove_cred(id)
@ -1311,16 +1337,16 @@ def test_ap_hs20_3gpp_constraints(dev, apdev):
dev[0].remove_cred(id)
values = default_cred()
values['roaming_consortium'] = "fedcba"
values['home_ois'] = ["fedcba"]
id3 = dev[0].add_cred_values(values)
vals2 = vals.copy()
vals2['roaming_consortium'] = "fedcba"
vals2['home_ois'] = ["fedcba"]
vals2['priority'] = "2"
id = dev[0].add_cred_values(vals2)
values = default_cred()
values['roaming_consortium'] = "fedcba"
values['home_ois'] = ["fedcba"]
id2 = dev[0].add_cred_values(values)
dev[0].request("INTERWORKING_SELECT freq=2412")
@ -1363,7 +1389,7 @@ def test_ap_hs20_connect_no_full_match(dev, apdev):
'password': "password",
'domain': "example.com",
'ca_cert': "auth_serv/ca.pem",
'roaming_consortium': "fedcba",
'home_ois': ["fedcba"],
'eap': "TTLS",
'min_dl_bandwidth_home': "65500"}
id = dev[0].add_cred_values(vals)
@ -1777,7 +1803,7 @@ def test_ap_hs20_prefer_home(dev, apdev):
values['domain'] = "example.org"
policy_test(dev[0], apdev[0], values, only_one=False)
def test_ap_hs20_req_roaming_consortium(dev, apdev):
def test_ap_hs20_req_home_ois(dev, apdev):
"""Hotspot 2.0 required roaming consortium"""
check_eap_capa(dev[0], "MSCHAPV2")
params = hs20_ap_params()
@ -1789,18 +1815,19 @@ def test_ap_hs20_req_roaming_consortium(dev, apdev):
hostapd.add_ap(apdev[1], params)
values = default_cred()
values['required_roaming_consortium'] = "223344"
values['required_home_ois'] = ["223344"]
policy_test(dev[0], apdev[1], values)
values['required_roaming_consortium'] = "112233"
values['required_home_ois'] = ["112233"]
policy_test(dev[0], apdev[0], values)
id = dev[0].add_cred()
dev[0].set_cred(id, "required_roaming_consortium", "112233")
dev[0].set_cred(id, "required_roaming_consortium", "112233445566778899aabbccddeeff")
dev[0].set_cred_quoted(id, "required_home_ois", "112233")
dev[0].set_cred_quoted(id, "required_home_ois",
"112233445566778899aabbccddeeff")
for val in ["", "1", "11", "1122", "1122334",
"112233445566778899aabbccddeeff00"]:
if "FAIL" not in dev[0].request('SET_CRED {} required_roaming_consortium {}'.format(id, val)):
"112233445566778899aabbccddeeff00", "1122334455,12345"]:
if "FAIL" not in dev[0].request('SET_CRED {} required_home_ois "{}"'.format(id, val)):
raise Exception("Invalid roaming consortium value accepted: " + val)
def test_ap_hs20_req_roaming_consortium_no_match(dev, apdev):
@ -1816,7 +1843,7 @@ def test_ap_hs20_req_roaming_consortium_no_match(dev, apdev):
hostapd.add_ap(apdev[1], params)
values = default_cred()
values['required_roaming_consortium'] = "223344"
values['required_home_ois'] = ["223344"]
dev[0].hs20_enable()
id = dev[0].add_cred_values(values)
dev[0].request("INTERWORKING_SELECT auto freq=2412")
@ -1851,7 +1878,7 @@ def test_ap_hs20_excluded_ssid(dev, apdev):
raise Exception("Excluded network not reported")
values = default_cred()
values['roaming_consortium'] = "223344"
values['home_ois'] = ["223344"]
values['eap'] = "TTLS"
values['phase2'] = "auth=MSCHAPV2"
values['excluded_ssid'] = "test-hs20"
@ -5549,7 +5576,7 @@ def test_ap_hs20_cred_with_nai_realm(dev, apdev):
'username': "test",
'password': "secret",
'domain': "example.com",
'roaming_consortium': "112234",
'home_ois': ["112234"],
'eap': 'TTLS'})
interworking_select(dev[0], bssid, "home", freq=2412, no_match=True)
dev[0].remove_cred(id)
@ -5568,7 +5595,7 @@ def test_ap_hs20_cred_and_no_roaming_consortium(dev, apdev):
'username': "test",
'password': "secret",
'domain': "example.com",
'roaming_consortium': "112234",
'home_ois': ["112234"],
'eap': 'TTLS'})
interworking_select(dev[0], bssid, "home", freq=2412)
@ -5644,7 +5671,7 @@ def test_ap_hs20_no_rsn_connect(dev, apdev):
'username': "test",
'password': "secret",
'domain': "example.com",
'roaming_consortium': "112233",
'home_ois': ["112233"],
'eap': 'TTLS'})
interworking_select(dev[0], bssid, freq=2412, no_match=True)
@ -5664,7 +5691,7 @@ def test_ap_hs20_no_match_connect(dev, apdev):
'username': "test",
'password': "secret",
'domain': "example.org",
'roaming_consortium': "112234",
'home_ois': ["112234"],
'eap': 'TTLS'})
interworking_select(dev[0], bssid, freq=2412, no_match=True)
@ -5721,7 +5748,7 @@ def test_ap_hs20_anqp_invalid_gas_response(dev, apdev):
'username': "test",
'password': "secret",
'domain': "example.com",
'roaming_consortium': "112234",
'home_ois': ["112234"],
'eap': 'TTLS'})
dev[0].request("INTERWORKING_SELECT freq=2412")
@ -5894,7 +5921,7 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
id = dev[0].add_cred_values({'roaming_consortium': "112233",
id = dev[0].add_cred_values({'home_ois': ["112233"],
'domain': "example.com",
'username': "hs20-test",
'password': "password",
@ -5916,7 +5943,7 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
dev[0].remove_cred(id)
dev[0].wait_disconnected()
id = dev[0].add_cred_values({'roaming_consortium': "112233",
id = dev[0].add_cred_values({'home_ois': ["112233"],
'domain': "example.com",
'realm': "example.com",
'username': "user",
@ -5934,7 +5961,7 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
id = dev[0].add_cred_values({'roaming_consortium': "112233",
id = dev[0].add_cred_values({'home_ois': ["112233"],
'domain': "example.com",
'realm': "example.com",
'username': "user",
@ -5958,7 +5985,7 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
id = dev[0].add_cred_values({'roaming_consortium': "112233",
id = dev[0].add_cred_values({'home_ois': ["112233"],
'domain': "example.com",
'realm': "example.com",
'username': "user",
@ -6032,7 +6059,7 @@ def test_ap_hs20_set_profile_failures(dev, apdev):
wait_fail_trigger(dev[0], "GET_ALLOC_FAIL")
dev[0].remove_cred(id)
id = dev[0].add_cred_values({'roaming_consortium': "112233",
id = dev[0].add_cred_values({'home_ois': ["112233"],
'eap': 'TTLS',
'username': "user@example.com",
'password': "password"})

View file

@ -6104,8 +6104,8 @@ def test_dbus_creds(dev, apdev):
args = {'domain': 'server.w1.fi',
'realm': 'server.w1.fi',
'roaming_consortium': '50a9bf',
'required_roaming_consortium': '23bf50',
'home_ois': '50a9bf',
'required_home_ois': '23bf50',
'eap': 'TTLS',
'phase2': 'auth=MSCHAPV2',
'username': 'user',

View file

@ -223,8 +223,8 @@ def test_wpas_config_file(dev, apdev, params):
wpas.set_cred_quoted(id, "provisioning_sp", "example.com")
wpas.set_cred_quoted(id, "domain", "example.com")
wpas.set_cred_quoted(id, "domain_suffix_match", "example.com")
wpas.set_cred(id, "roaming_consortium", "112233")
wpas.set_cred(id, "required_roaming_consortium", "112233")
wpas.set_cred_quoted(id, "home_ois", "112233,445566")
wpas.set_cred_quoted(id, "required_home_ois", "112233")
wpas.set_cred_quoted(id, "roaming_consortiums",
"112233,aabbccddee,445566")
wpas.set_cred_quoted(id, "roaming_partner",

View file

@ -467,6 +467,14 @@ def test_wpas_ctrl_cred(dev):
for i in ("11", "1122", "112233445566778899aabbccddeeff00"):
if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " roaming_consortium " + i):
raise Exception("Unexpected success on invalid roaming_consortium")
if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " home_ois " + '"' + i + '"'):
raise Exception("Unexpected success on invalid home_ois")
if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " required_home_ois " + '"' + i + '"'):
raise Exception("Unexpected success on invalid required_home_ois")
if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " home_ois " + '"112233' + 36*",112233" + '"'):
raise Exception("Unexpected success on invalid home_ois")
if "FAIL" in dev[0].request("SET_CRED " + str(id) + " home_ois " + '"112233' + 35*",112233" + '"'):
raise Exception("Unexpected failure on maximum number of home_ois")
dev[0].set_cred(id, "excluded_ssid", "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff")
if "FAIL" not in dev[0].request("SET_CRED " + str(id) + " excluded_ssid 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00"):

View file

@ -469,6 +469,11 @@ class WpaSupplicant:
if field in params:
self.set_cred(id, field, params[field])
as_list = ["home_ois", "required_home_ois"]
for field in as_list:
if field in params:
self.set_cred_quoted(id, field, ','.join(params[field]))
return id
def select_network(self, id, freq=None):