tests: Call stop_sigma_dut() in more failure cases

Some of the sigma_dut test cases were not yet using try/finally to
ensure stop_sigma_dut() gets called. That could result in not logging
all failure reasons in the log and getting stuck with being unable to
start new sigma_dut processes after failed test cases.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2020-01-10 00:19:27 +02:00 committed by Jouni Malinen
parent f0b6b23fe3
commit 991e6b9e79

View file

@ -162,21 +162,22 @@ def test_sigma_dut_basic(dev, apdev):
"""sigma_dut basic functionality""" """sigma_dut basic functionality"""
sigma = start_sigma_dut(dev[0].ifname) sigma = start_sigma_dut(dev[0].ifname)
res = sigma_dut_cmd("UNKNOWN")
if "status,INVALID,errorCode,Unknown command" not in res:
raise Exception("Unexpected sigma_dut response to unknown command")
tests = [("ca_get_version", "status,COMPLETE,version,1.0"), tests = [("ca_get_version", "status,COMPLETE,version,1.0"),
("device_get_info", "status,COMPLETE,vendor"), ("device_get_info", "status,COMPLETE,vendor"),
("device_list_interfaces,interfaceType,foo", "status,ERROR"), ("device_list_interfaces,interfaceType,foo", "status,ERROR"),
("device_list_interfaces,interfaceType,802.11", ("device_list_interfaces,interfaceType,802.11",
"status,COMPLETE,interfaceType,802.11,interfaceID," + dev[0].ifname)] "status,COMPLETE,interfaceType,802.11,interfaceID," + dev[0].ifname)]
for cmd, response in tests: try:
res = sigma_dut_cmd(cmd) res = sigma_dut_cmd("UNKNOWN")
if response not in res: if "status,INVALID,errorCode,Unknown command" not in res:
raise Exception("Unexpected %s response: %s" % (cmd, res)) raise Exception("Unexpected sigma_dut response to unknown command")
stop_sigma_dut(sigma) for cmd, response in tests:
res = sigma_dut_cmd(cmd)
if response not in res:
raise Exception("Unexpected %s response: %s" % (cmd, res))
finally:
stop_sigma_dut(sigma)
def test_sigma_dut_open(dev, apdev): def test_sigma_dut_open(dev, apdev):
"""sigma_dut controlled open network association""" """sigma_dut controlled open network association"""
@ -189,17 +190,18 @@ def run_sigma_dut_open(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"}) try:
hapd = hostapd.add_ap(apdev[0], {"ssid": "open"})
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_encryption,interface,%s,ssid,%s,encpType,none" % (ifname, "open")) sigma_dut_cmd_check("sta_set_encryption,interface,%s,ssid,%s,encpType,none" % (ifname, "open"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s" % (ifname, "open")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s" % (ifname, "open"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_psk_pmf(dev, apdev): def test_sigma_dut_psk_pmf(dev, apdev):
"""sigma_dut controlled PSK+PMF association""" """sigma_dut controlled PSK+PMF association"""
@ -212,22 +214,23 @@ def run_sigma_dut_psk_pmf(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-pmf-required" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "test-pmf-required"
params["wpa_key_mgmt"] = "WPA-PSK-SHA256" params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
params["ieee80211w"] = "2" params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
hapd = hostapd.add_ap(apdev[0], params) params["ieee80211w"] = "2"
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_psk,interface,%s,ssid,%s,passphrase,%s,encpType,aes-ccmp,keymgmttype,wpa2,PMF,Required" % (ifname, "test-pmf-required", "12345678")) sigma_dut_cmd_check("sta_set_psk,interface,%s,ssid,%s,passphrase,%s,encpType,aes-ccmp,keymgmttype,wpa2,PMF,Required" % (ifname, "test-pmf-required", "12345678"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-pmf-required")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-pmf-required"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_psk_pmf_bip_cmac_128(dev, apdev): def test_sigma_dut_psk_pmf_bip_cmac_128(dev, apdev):
"""sigma_dut controlled PSK+PMF association with BIP-CMAC-128""" """sigma_dut controlled PSK+PMF association with BIP-CMAC-128"""
@ -270,35 +273,36 @@ def run_sigma_dut_psk_pmf_cipher(dev, apdev, sigma_cipher, hostapd_cipher,
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-pmf-required" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "test-pmf-required"
params["wpa_key_mgmt"] = "WPA-PSK-SHA256" params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
params["ieee80211w"] = "2" params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
params["group_mgmt_cipher"] = hostapd_cipher params["ieee80211w"] = "2"
hapd = hostapd.add_ap(apdev[0], params) params["group_mgmt_cipher"] = hostapd_cipher
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_psk,interface,%s,ssid,%s,passphrase,%s,encpType,aes-ccmp,keymgmttype,wpa2,PMF,Required,GroupMgntCipher,%s" % (ifname, "test-pmf-required", "12345678", sigma_cipher)) sigma_dut_cmd_check("sta_set_psk,interface,%s,ssid,%s,passphrase,%s,encpType,aes-ccmp,keymgmttype,wpa2,PMF,Required,GroupMgntCipher,%s" % (ifname, "test-pmf-required", "12345678", sigma_cipher))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-pmf-required")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-pmf-required"))
if failure: if failure:
ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-NOT-FOUND", ev = dev[0].wait_event(["CTRL-EVENT-NETWORK-NOT-FOUND",
"CTRL-EVENT-CONNECTED"], timeout=10) "CTRL-EVENT-CONNECTED"], timeout=10)
if ev is None: if ev is None:
raise Exception("Network selection result not indicated") raise Exception("Network selection result not indicated")
if "CTRL-EVENT-CONNECTED" in ev: if "CTRL-EVENT-CONNECTED" in ev:
raise Exception("Unexpected connection") raise Exception("Unexpected connection")
res = sigma_dut_cmd("sta_is_connected,interface," + ifname) res = sigma_dut_cmd("sta_is_connected,interface," + ifname)
if "connected,1" in res: if "connected,1" in res:
raise Exception("Connection reported") raise Exception("Connection reported")
else: else:
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_sae(dev, apdev): def test_sigma_dut_sae(dev, apdev):
"""sigma_dut controlled SAE association""" """sigma_dut controlled SAE association"""
@ -308,36 +312,37 @@ def test_sigma_dut_sae(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-sae" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "test-sae"
params['wpa_key_mgmt'] = 'SAE' params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
params["ieee80211w"] = "2" params['wpa_key_mgmt'] = 'SAE'
params['sae_groups'] = '19 20 21' params["ieee80211w"] = "2"
hapd = hostapd.add_ap(apdev[0], params) params['sae_groups'] = '19 20 21'
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2" % (ifname, "test-sae", "12345678")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2" % (ifname, "test-sae", "12345678"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
if dev[0].get_status_field('sae_group') != '19': if dev[0].get_status_field('sae_group') != '19':
raise Exception("Expected default SAE group not used") raise Exception("Expected default SAE group not used")
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2,ECGroupID,20" % (ifname, "test-sae", "12345678")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2,ECGroupID,20" % (ifname, "test-sae", "12345678"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
if dev[0].get_status_field('sae_group') != '20': if dev[0].get_status_field('sae_group') != '20':
raise Exception("Expected SAE group not used") raise Exception("Expected SAE group not used")
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_sae_groups(dev, apdev): def test_sigma_dut_sae_groups(dev, apdev):
"""sigma_dut controlled SAE association with group negotiation""" """sigma_dut controlled SAE association with group negotiation"""
@ -347,26 +352,27 @@ def test_sigma_dut_sae_groups(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-sae" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "test-sae"
params['wpa_key_mgmt'] = 'SAE' params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
params["ieee80211w"] = "2" params['wpa_key_mgmt'] = 'SAE'
params['sae_groups'] = '19' params["ieee80211w"] = "2"
hapd = hostapd.add_ap(apdev[0], params) params['sae_groups'] = '19'
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2,ECGroupID,21 20 19" % (ifname, "test-sae", "12345678")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2,ECGroupID,21 20 19" % (ifname, "test-sae", "12345678"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
if dev[0].get_status_field('sae_group') != '19': if dev[0].get_status_field('sae_group') != '19':
raise Exception("Expected default SAE group not used") raise Exception("Expected default SAE group not used")
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_sae_pmkid_include(dev, apdev): def test_sigma_dut_sae_pmkid_include(dev, apdev):
"""sigma_dut controlled SAE association with PMKID""" """sigma_dut controlled SAE association with PMKID"""
@ -376,20 +382,22 @@ def test_sigma_dut_sae_pmkid_include(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-sae" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "test-sae"
params['wpa_key_mgmt'] = 'SAE' params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
params["ieee80211w"] = "2" params['wpa_key_mgmt'] = 'SAE'
params["sae_confirm_immediate"] = "1" params["ieee80211w"] = "2"
hapd = hostapd.add_ap(apdev[0], params) params["sae_confirm_immediate"] = "1"
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2,PMKID_Include,enable" % (ifname, "test-sae", "12345678")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,keymgmttype,wpa2,PMKID_Include,enable" % (ifname, "test-sae", "12345678"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
stop_sigma_dut(sigma) finally:
stop_sigma_dut(sigma)
def test_sigma_dut_sae_password(dev, apdev): def test_sigma_dut_sae_password(dev, apdev):
"""sigma_dut controlled SAE association and long password""" """sigma_dut controlled SAE association and long password"""
@ -426,23 +434,24 @@ def test_sigma_dut_sae_pw_id(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-sae" try:
params = hostapd.wpa2_params(ssid=ssid) ssid = "test-sae"
params['wpa_key_mgmt'] = 'SAE' params = hostapd.wpa2_params(ssid=ssid)
params["ieee80211w"] = "2" params['wpa_key_mgmt'] = 'SAE'
params['sae_password'] = 'secret|id=pw id' params["ieee80211w"] = "2"
params['sae_groups'] = '19' params['sae_password'] = 'secret|id=pw id'
hapd = hostapd.add_ap(apdev[0], params) params['sae_groups'] = '19'
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,AKMSuiteType,8;9,PasswordID,pw id" % (ifname, "test-sae", "secret")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,AKMSuiteType,8;9,PasswordID,pw id" % (ifname, "test-sae", "secret"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_sae_pw_id_ft(dev, apdev): def test_sigma_dut_sae_pw_id_ft(dev, apdev):
"""sigma_dut controlled SAE association with Password Identifier and FT""" """sigma_dut controlled SAE association with Password Identifier and FT"""
@ -459,41 +468,42 @@ def run_sigma_dut_sae_pw_id_ft(dev, apdev, over_ds=False):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-sae" try:
params = hostapd.wpa2_params(ssid=ssid) ssid = "test-sae"
params['wpa_key_mgmt'] = 'SAE FT-SAE' params = hostapd.wpa2_params(ssid=ssid)
params["ieee80211w"] = "2" params['wpa_key_mgmt'] = 'SAE FT-SAE'
params['sae_password'] = ['pw1|id=id1', 'pw2|id=id2', 'pw3', 'pw4|id=id4'] params["ieee80211w"] = "2"
params['mobility_domain'] = 'aabb' params['sae_password'] = ['pw1|id=id1', 'pw2|id=id2', 'pw3', 'pw4|id=id4']
params['ft_over_ds'] = '1' if over_ds else '0' params['mobility_domain'] = 'aabb'
bssid = apdev[0]['bssid'].replace(':', '') params['ft_over_ds'] = '1' if over_ds else '0'
params['nas_identifier'] = bssid + '.nas.example.com' bssid = apdev[0]['bssid'].replace(':', '')
params['r1_key_holder'] = bssid params['nas_identifier'] = bssid + '.nas.example.com'
params['pmk_r1_push'] = '0' params['r1_key_holder'] = bssid
params['r0kh'] = 'ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff' params['pmk_r1_push'] = '0'
params['r1kh'] = '00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff' params['r0kh'] = 'ff:ff:ff:ff:ff:ff * 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff'
hapd = hostapd.add_ap(apdev[0], params) params['r1kh'] = '00:00:00:00:00:00 00:00:00:00:00:00 00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff'
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s" % ifname)
if over_ds: if over_ds:
sigma_dut_cmd_check("sta_preset_testparameters,interface,%s,FT_DS,Enable" % ifname) sigma_dut_cmd_check("sta_preset_testparameters,interface,%s,FT_DS,Enable" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,AKMSuiteType,8;9,PasswordID,id2" % (ifname, "test-sae", "pw2")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,passphrase,%s,type,SAE,encpType,aes-ccmp,AKMSuiteType,8;9,PasswordID,id2" % (ifname, "test-sae", "pw2"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-sae"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
bssid = apdev[1]['bssid'].replace(':', '') bssid = apdev[1]['bssid'].replace(':', '')
params['nas_identifier'] = bssid + '.nas.example.com' params['nas_identifier'] = bssid + '.nas.example.com'
params['r1_key_holder'] = bssid params['r1_key_holder'] = bssid
hapd2 = hostapd.add_ap(apdev[1], params) hapd2 = hostapd.add_ap(apdev[1], params)
bssid = hapd2.own_addr() bssid = hapd2.own_addr()
sigma_dut_cmd_check("sta_reassoc,interface,%s,Channel,1,bssid,%s" % (ifname, bssid)) sigma_dut_cmd_check("sta_reassoc,interface,%s,Channel,1,bssid,%s" % (ifname, bssid))
dev[0].wait_connected() dev[0].wait_connected()
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_sta_override_rsne(dev, apdev): def test_sigma_dut_sta_override_rsne(dev, apdev):
"""sigma_dut and RSNE override on STA""" """sigma_dut and RSNE override on STA"""
@ -506,35 +516,36 @@ def run_sigma_dut_sta_override_rsne(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "test-psk" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "test-psk"
hapd = hostapd.add_ap(apdev[0], params) params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
tests = ["30120100000fac040100000fac040100000fac02",
"30140100000fac040100000fac040100000fac02ffff"]
for test in tests:
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,type,PSK,passphrase,%s,EncpType,aes-ccmp,KeyMgmtType,wpa2" % (ifname, "test-psk", "12345678"))
sigma_dut_cmd_check("dev_configure_ie,interface,%s,IE_Name,RSNE,Contents,%s" % (ifname, test))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-psk"))
sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
dev[0].dump_monitor()
tests = ["30120100000fac040100000fac040100000fac02",
"30140100000fac040100000fac040100000fac02ffff"]
for test in tests:
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,type,PSK,passphrase,%s,EncpType,aes-ccmp,KeyMgmtType,wpa2" % (ifname, "test-psk", "12345678")) sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,type,PSK,passphrase,%s,EncpType,aes-ccmp,KeyMgmtType,wpa2" % (ifname, "test-psk", "12345678"))
sigma_dut_cmd_check("dev_configure_ie,interface,%s,IE_Name,RSNE,Contents,%s" % (ifname, test)) sigma_dut_cmd_check("dev_configure_ie,interface,%s,IE_Name,RSNE,Contents,300101" % ifname)
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-psk")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-psk"))
sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
dev[0].dump_monitor()
sigma_dut_cmd_check("sta_set_security,interface,%s,ssid,%s,type,PSK,passphrase,%s,EncpType,aes-ccmp,KeyMgmtType,wpa2" % (ifname, "test-psk", "12345678")) ev = dev[0].wait_event(["CTRL-EVENT-ASSOC-REJECT"])
sigma_dut_cmd_check("dev_configure_ie,interface,%s,IE_Name,RSNE,Contents,300101" % ifname) if ev is None:
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-psk")) raise Exception("Association rejection not reported")
if "status_code=40" not in ev:
raise Exception("Unexpected status code: " + ev)
ev = dev[0].wait_event(["CTRL-EVENT-ASSOC-REJECT"]) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
if ev is None: finally:
raise Exception("Association rejection not reported") stop_sigma_dut(sigma)
if "status_code=40" not in ev:
raise Exception("Unexpected status code: " + ev)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
stop_sigma_dut(sigma)
def test_sigma_dut_ap_psk(dev, apdev): def test_sigma_dut_ap_psk(dev, apdev):
"""sigma_dut controlled AP""" """sigma_dut controlled AP"""
@ -657,41 +668,42 @@ def test_sigma_dut_eap_ttls(dev, apdev, params):
cmd = "sta_set_security,type,eapttls,interface,%s,ssid,%s,keymgmttype,wpa2,encType,AES-CCMP,PairwiseCipher,AES-CCMP-128,trustedRootCA,sigma_dut_eap_ttls.ca.pem,username,DOMAIN\mschapv2 user,password,password" % (ifname, ssid) cmd = "sta_set_security,type,eapttls,interface,%s,ssid,%s,keymgmttype,wpa2,encType,AES-CCMP,PairwiseCipher,AES-CCMP-128,trustedRootCA,sigma_dut_eap_ttls.ca.pem,username,DOMAIN\mschapv2 user,password,password" % (ifname, ssid)
tests = ["", try:
",Domain,server.w1.fi", tests = ["",
",DomainSuffix,w1.fi", ",Domain,server.w1.fi",
",DomainSuffix,server.w1.fi", ",DomainSuffix,w1.fi",
",ServerCert,sigma_dut_eap_ttls.server.pem"] ",DomainSuffix,server.w1.fi",
for extra in tests: ",ServerCert,sigma_dut_eap_ttls.server.pem"]
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,WPA3" % ifname) for extra in tests:
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,WPA3" % ifname)
sigma_dut_cmd_check(cmd + extra) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, ssid)) sigma_dut_cmd_check(cmd + extra)
sigma_dut_wait_connected(ifname) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, ssid))
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
dev[0].dump_monitor() sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
dev[0].dump_monitor()
tests = [",Domain,w1.fi", tests = [",Domain,w1.fi",
",DomainSuffix,example.com", ",DomainSuffix,example.com",
",ServerCert,sigma_dut_eap_ttls.incorrect.pem"] ",ServerCert,sigma_dut_eap_ttls.incorrect.pem"]
for extra in tests: for extra in tests:
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,WPA3" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,WPA3" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check(cmd + extra) sigma_dut_cmd_check(cmd + extra)
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, ssid)) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, ssid))
ev = dev[0].wait_event(["CTRL-EVENT-EAP-TLS-CERT-ERROR"], timeout=10) ev = dev[0].wait_event(["CTRL-EVENT-EAP-TLS-CERT-ERROR"], timeout=10)
if ev is None: if ev is None:
raise Exception("Server certificate error not reported") raise Exception("Server certificate error not reported")
res = sigma_dut_cmd("sta_is_connected,interface," + ifname) res = sigma_dut_cmd("sta_is_connected,interface," + ifname)
if "connected,1" in res: if "connected,1" in res:
raise Exception("Unexpected connection reported") raise Exception("Unexpected connection reported")
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
dev[0].dump_monitor() dev[0].dump_monitor()
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_suite_b(dev, apdev, params): def test_sigma_dut_suite_b(dev, apdev, params):
"""sigma_dut controlled STA Suite B""" """sigma_dut controlled STA Suite B"""
@ -732,16 +744,17 @@ def test_sigma_dut_suite_b(dev, apdev, params):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname, cert_path=logdir) sigma = start_sigma_dut(ifname, cert_path=logdir)
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname) try:
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname)
sigma_dut_cmd_check("sta_set_security,type,eaptls,interface,%s,ssid,%s,PairwiseCipher,AES-GCMP-256,GroupCipher,AES-GCMP-256,GroupMgntCipher,BIP-GMAC-256,keymgmttype,SuiteB,clientCertificate,suite_b.pem,trustedRootCA,suite_b_ca.pem,CertType,ECC" % (ifname, "test-suite-b")) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-suite-b")) sigma_dut_cmd_check("sta_set_security,type,eaptls,interface,%s,ssid,%s,PairwiseCipher,AES-GCMP-256,GroupCipher,AES-GCMP-256,GroupMgntCipher,BIP-GMAC-256,keymgmttype,SuiteB,clientCertificate,suite_b.pem,trustedRootCA,suite_b_ca.pem,CertType,ECC" % (ifname, "test-suite-b"))
sigma_dut_wait_connected(ifname) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-suite-b"))
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
stop_sigma_dut(sigma) finally:
stop_sigma_dut(sigma)
def test_sigma_dut_suite_b_rsa(dev, apdev, params): def test_sigma_dut_suite_b_rsa(dev, apdev, params):
"""sigma_dut controlled STA Suite B (RSA)""" """sigma_dut controlled STA Suite B (RSA)"""
@ -767,20 +780,21 @@ def test_sigma_dut_suite_b_rsa(dev, apdev, params):
cmd = "sta_set_security,type,eaptls,interface,%s,ssid,%s,PairwiseCipher,AES-GCMP-256,GroupCipher,AES-GCMP-256,GroupMgntCipher,BIP-GMAC-256,keymgmttype,SuiteB,clientCertificate,suite_b_rsa.pem,trustedRootCA,suite_b_ca_rsa.pem,CertType,RSA" % (ifname, "test-suite-b") cmd = "sta_set_security,type,eaptls,interface,%s,ssid,%s,PairwiseCipher,AES-GCMP-256,GroupCipher,AES-GCMP-256,GroupMgntCipher,BIP-GMAC-256,keymgmttype,SuiteB,clientCertificate,suite_b_rsa.pem,trustedRootCA,suite_b_ca_rsa.pem,CertType,RSA" % (ifname, "test-suite-b")
tests = ["", try:
",TLSCipher,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", tests = ["",
",TLSCipher,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384"] ",TLSCipher,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
for extra in tests: ",TLSCipher,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384"]
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname) for extra in tests:
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname)
sigma_dut_cmd_check(cmd + extra) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-suite-b")) sigma_dut_cmd_check(cmd + extra)
sigma_dut_wait_connected(ifname) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "test-suite-b"))
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
stop_sigma_dut(sigma) finally:
stop_sigma_dut(sigma)
def test_sigma_dut_ap_suite_b(dev, apdev, params): def test_sigma_dut_ap_suite_b(dev, apdev, params):
"""sigma_dut controlled AP Suite B""" """sigma_dut controlled AP Suite B"""
@ -2705,19 +2719,20 @@ def run_sigma_dut_preconfigured_profile(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
params = hostapd.wpa2_params(ssid="test-psk", passphrase="12345678") try:
hapd = hostapd.add_ap(apdev[0], params) params = hostapd.wpa2_params(ssid="test-psk", passphrase="12345678")
dev[0].connect("test-psk", psk="12345678", scan_freq="2412", hapd = hostapd.add_ap(apdev[0], params)
only_add_network=True) dev[0].connect("test-psk", psk="12345678", scan_freq="2412",
only_add_network=True)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s" % (ifname, "test-psk")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s" % (ifname, "test-psk"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_wps_pbc(dev, apdev): def test_sigma_dut_wps_pbc(dev, apdev):
"""sigma_dut and WPS PBC Enrollee""" """sigma_dut and WPS PBC Enrollee"""
@ -2737,15 +2752,17 @@ def run_sigma_dut_wps_pbc(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
cmd = "start_wps_registration,interface,%s" % ifname try:
cmd += ",WpsRole,Enrollee" cmd = "start_wps_registration,interface,%s" % ifname
cmd += ",WpsConfigMethod,PBC" cmd += ",WpsRole,Enrollee"
sigma_dut_cmd_check(cmd, timeout=15) cmd += ",WpsConfigMethod,PBC"
sigma_dut_cmd_check(cmd, timeout=15)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
hapd.disable() hapd.disable()
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
stop_sigma_dut(sigma) finally:
stop_sigma_dut(sigma)
dev[0].flush_scan_cache() dev[0].flush_scan_cache()
def test_sigma_dut_sta_scan_bss(dev, apdev): def test_sigma_dut_sta_scan_bss(dev, apdev):
@ -2980,42 +2997,43 @@ def run_sigma_dut_venue_url(dev, apdev):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
ssid = "venue" try:
params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678") ssid = "venue"
params["wpa_key_mgmt"] = "WPA-PSK-SHA256" params = hostapd.wpa2_params(ssid=ssid, passphrase="12345678")
params["ieee80211w"] = "2" params["wpa_key_mgmt"] = "WPA-PSK-SHA256"
params["ieee80211w"] = "2"
venue_group = 1 venue_group = 1
venue_type = 13 venue_type = 13
venue_info = struct.pack('BB', venue_group, venue_type) venue_info = struct.pack('BB', venue_group, venue_type)
lang1 = "eng" lang1 = "eng"
name1 = "Example venue" name1 = "Example venue"
lang2 = "fin" lang2 = "fin"
name2 = "Esimerkkipaikka" name2 = "Esimerkkipaikka"
venue1 = struct.pack('B', len(lang1 + name1)) + lang1.encode() + name1.encode() venue1 = struct.pack('B', len(lang1 + name1)) + lang1.encode() + name1.encode()
venue2 = struct.pack('B', len(lang2 + name2)) + lang2.encode() + name2.encode() venue2 = struct.pack('B', len(lang2 + name2)) + lang2.encode() + name2.encode()
venue_name = binascii.hexlify(venue_info + venue1 + venue2) venue_name = binascii.hexlify(venue_info + venue1 + venue2)
url1 = "http://example.com/venue" url1 = "http://example.com/venue"
url2 = "https://example.org/venue-info/" url2 = "https://example.org/venue-info/"
params["venue_group"] = str(venue_group) params["venue_group"] = str(venue_group)
params["venue_type"] = str(venue_type) params["venue_type"] = str(venue_type)
params["venue_name"] = [lang1 + ":" + name1, lang2 + ":" + name2] params["venue_name"] = [lang1 + ":" + name1, lang2 + ":" + name2]
params["venue_url"] = ["1:" + url1, "2:" + url2] params["venue_url"] = ["1:" + url1, "2:" + url2]
hapd = hostapd.add_ap(apdev[0], params) hapd = hostapd.add_ap(apdev[0], params)
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,PMF" % ifname)
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
sigma_dut_cmd_check("sta_set_psk,interface,%s,ssid,%s,passphrase,%s,encpType,aes-ccmp,keymgmttype,wpa2,PMF,Required" % (ifname, "venue", "12345678")) sigma_dut_cmd_check("sta_set_psk,interface,%s,ssid,%s,passphrase,%s,encpType,aes-ccmp,keymgmttype,wpa2,PMF,Required" % (ifname, "venue", "12345678"))
sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "venue")) sigma_dut_cmd_check("sta_associate,interface,%s,ssid,%s,channel,1" % (ifname, "venue"))
sigma_dut_wait_connected(ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_hs2_venue_info,interface," + ifname + ",Display,Yes") sigma_dut_cmd_check("sta_hs2_venue_info,interface," + ifname + ",Display,Yes")
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
finally:
stop_sigma_dut(sigma) stop_sigma_dut(sigma)
def test_sigma_dut_hs20_assoc_24(dev, apdev): def test_sigma_dut_hs20_assoc_24(dev, apdev):
"""sigma_dut controlled Hotspot 2.0 connection (2.4 GHz)""" """sigma_dut controlled Hotspot 2.0 connection (2.4 GHz)"""
@ -3061,17 +3079,18 @@ def run_sigma_dut_hs20_assoc_2(dev, apdev, band, expect_bssid):
ifname = dev[0].ifname ifname = dev[0].ifname
sigma = start_sigma_dut(ifname) sigma = start_sigma_dut(ifname)
sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,HS2-R3" % ifname) try:
sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname) sigma_dut_cmd_check("sta_reset_default,interface,%s,prog,HS2-R3" % ifname)
sigma_dut_cmd_check("sta_add_credential,interface,%s,type,uname_pwd,realm,example.com,username,hs20-test,password,password" % ifname) sigma_dut_cmd_check("sta_set_ip_config,interface,%s,dhcp,0,ip,127.0.0.11,mask,255.255.255.0" % ifname)
res = sigma_dut_cmd_check("sta_hs2_associate,interface,%s,band,%s" % (ifname, band), sigma_dut_cmd_check("sta_add_credential,interface,%s,type,uname_pwd,realm,example.com,username,hs20-test,password,password" % ifname)
timeout=15) res = sigma_dut_cmd_check("sta_hs2_associate,interface,%s,band,%s" % (ifname, band),
sigma_dut_wait_connected(ifname) timeout=15)
sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname) sigma_dut_wait_connected(ifname)
sigma_dut_cmd_check("sta_disconnect,interface," + ifname) sigma_dut_cmd_check("sta_get_ip_config,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname) sigma_dut_cmd_check("sta_disconnect,interface," + ifname)
sigma_dut_cmd_check("sta_reset_default,interface," + ifname)
stop_sigma_dut(sigma) finally:
stop_sigma_dut(sigma)
if "BSSID," + expect_bssid not in res: if "BSSID," + expect_bssid not in res:
raise Exception("Unexpected BSSID: " + res) raise Exception("Unexpected BSSID: " + res)