tests: INTERWORKING_ADD_NETWORK
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
f91a512f1f
commit
2265376271
2 changed files with 24 additions and 4 deletions
|
@ -65,7 +65,7 @@ def interworking_select(dev, bssid, type=None, no_match=False, freq=None):
|
||||||
dev.dump_monitor()
|
dev.dump_monitor()
|
||||||
if bssid and freq and not no_match:
|
if bssid and freq and not no_match:
|
||||||
dev.scan_for_bss(bssid, freq=freq)
|
dev.scan_for_bss(bssid, freq=freq)
|
||||||
freq_extra = " freq=" + freq if freq else ""
|
freq_extra = " freq=" + str(freq) if freq else ""
|
||||||
dev.request("INTERWORKING_SELECT" + freq_extra)
|
dev.request("INTERWORKING_SELECT" + freq_extra)
|
||||||
ev = dev.wait_event(["INTERWORKING-AP", "INTERWORKING-NO-MATCH"],
|
ev = dev.wait_event(["INTERWORKING-AP", "INTERWORKING-NO-MATCH"],
|
||||||
timeout=15)
|
timeout=15)
|
||||||
|
@ -1087,10 +1087,10 @@ def policy_test(dev, ap, values, only_one=True):
|
||||||
dev.dump_monitor()
|
dev.dump_monitor()
|
||||||
return events
|
return events
|
||||||
|
|
||||||
def default_cred(domain=None):
|
def default_cred(domain=None, user="hs20-test"):
|
||||||
cred = { 'realm': "example.com",
|
cred = { 'realm': "example.com",
|
||||||
'ca_cert': "auth_serv/ca.pem",
|
'ca_cert': "auth_serv/ca.pem",
|
||||||
'username': "hs20-test",
|
'username': user,
|
||||||
'password': "password" }
|
'password': "password" }
|
||||||
if domain:
|
if domain:
|
||||||
cred['domain'] = domain
|
cred['domain'] = domain
|
||||||
|
@ -2448,6 +2448,20 @@ def test_ap_hs20_multi_network_and_cred_removal(dev, apdev):
|
||||||
raise Exception("Unexpected number of networks after to remove_crec")
|
raise Exception("Unexpected number of networks after to remove_crec")
|
||||||
dev[0].wait_disconnected(timeout=10)
|
dev[0].wait_disconnected(timeout=10)
|
||||||
|
|
||||||
|
def test_ap_hs20_interworking_add_network(dev, apdev):
|
||||||
|
"""Hotspot 2.0 connection using INTERWORKING_ADD_NETWORK"""
|
||||||
|
bssid = apdev[0]['bssid']
|
||||||
|
params = hs20_ap_params()
|
||||||
|
params['nai_realm'] = [ "0,example.com,21[3:26][6:7][99:99]" ]
|
||||||
|
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||||
|
|
||||||
|
dev[0].hs20_enable()
|
||||||
|
dev[0].add_cred_values(default_cred(user="user"))
|
||||||
|
interworking_select(dev[0], bssid, freq=2412)
|
||||||
|
id = dev[0].interworking_add_network(bssid)
|
||||||
|
dev[0].select_network(id, freq=2412)
|
||||||
|
dev[0].wait_connected()
|
||||||
|
|
||||||
def _test_ap_hs20_proxyarp(dev, apdev):
|
def _test_ap_hs20_proxyarp(dev, apdev):
|
||||||
bssid = apdev[0]['bssid']
|
bssid = apdev[0]['bssid']
|
||||||
params = hs20_ap_params()
|
params = hs20_ap_params()
|
||||||
|
|
|
@ -207,6 +207,12 @@ class WpaSupplicant:
|
||||||
else:
|
else:
|
||||||
self.request("SET auto_interworking 0")
|
self.request("SET auto_interworking 0")
|
||||||
|
|
||||||
|
def interworking_add_network(self, bssid):
|
||||||
|
id = self.request("INTERWORKING_ADD_NETWORK " + bssid)
|
||||||
|
if "FAIL" in id or "OK" in id:
|
||||||
|
raise Exception("INTERWORKING_ADD_NETWORK failed")
|
||||||
|
return int(id)
|
||||||
|
|
||||||
def add_cred(self):
|
def add_cred(self):
|
||||||
id = self.request("ADD_CRED")
|
id = self.request("ADD_CRED")
|
||||||
if "FAIL" in id:
|
if "FAIL" in id:
|
||||||
|
@ -258,7 +264,7 @@ class WpaSupplicant:
|
||||||
|
|
||||||
def select_network(self, id, freq=None):
|
def select_network(self, id, freq=None):
|
||||||
if freq:
|
if freq:
|
||||||
extra = " freq=" + freq
|
extra = " freq=" + str(freq)
|
||||||
else:
|
else:
|
||||||
extra = ""
|
extra = ""
|
||||||
id = self.request("SELECT_NETWORK " + str(id) + extra)
|
id = self.request("SELECT_NETWORK " + str(id) + extra)
|
||||||
|
|
Loading…
Add table
Reference in a new issue