From d355372ce46e65a5d30237ae0b5d169ebfaa32fa Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 4 Nov 2013 13:22:55 +0200 Subject: [PATCH] tests: HS 2.0 excluded SSID Signed-hostap: Jouni Malinen --- tests/hwsim/test_ap_hs20.py | 27 +++++++++++++++++++++++---- tests/hwsim/wpasupplicant.py | 3 ++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/tests/hwsim/test_ap_hs20.py b/tests/hwsim/test_ap_hs20.py index ea67fd141..9a525d157 100644 --- a/tests/hwsim/test_ap_hs20.py +++ b/tests/hwsim/test_ap_hs20.py @@ -276,6 +276,11 @@ def policy_test(dev, ap, values, only_one=True): dev.remove_cred(id) dev.dump_monitor() +def default_cred(): + return { 'realm': "example.com", + 'username': "hs20-test", + 'password': "password" } + def test_ap_hs20_req_roaming_consortium(dev, apdev): """Hotspot 2.0 required roaming consortium""" params = hs20_ap_params() @@ -286,10 +291,24 @@ def test_ap_hs20_req_roaming_consortium(dev, apdev): params['roaming_consortium'] = [ "223344" ] hostapd.add_ap(apdev[1]['ifname'], params) - values = { 'realm': "example.com", - 'username': "hs20-test", - 'password': "password", - 'required_roaming_consortium': "223344" } + values = default_cred() + values['required_roaming_consortium'] = "223344" policy_test(dev[0], apdev[1], values) values['required_roaming_consortium'] = "112233" policy_test(dev[0], apdev[0], values) + +def test_ap_hs20_excluded_ssid(dev, apdev): + """Hotspot 2.0 exclusion based on SSID""" + params = hs20_ap_params() + hostapd.add_ap(apdev[0]['ifname'], params) + + params = hs20_ap_params() + params['ssid'] = "test-hs20-other" + params['roaming_consortium'] = [ "223344" ] + hostapd.add_ap(apdev[1]['ifname'], params) + + values = default_cred() + values['excluded_ssid'] = "test-hs20" + policy_test(dev[0], apdev[1], values) + values['excluded_ssid'] = "test-hs20-other" + policy_test(dev[0], apdev[0], values) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index fddc2f9a2..40d3d33ae 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -149,7 +149,8 @@ class WpaSupplicant: def add_cred_values(self, params): id = self.add_cred() - quoted = [ "realm", "username", "password", "domain", "imsi" ] + quoted = [ "realm", "username", "password", "domain", "imsi", + "excluded_ssid" ] for field in quoted: if field in params: self.set_cred_quoted(id, field, params[field])