tests: wps_priority in configuration and WPS behavior

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-06-04 14:04:16 +03:00 committed by Jouni Malinen
parent 94687a0aae
commit d6f6a86a04
2 changed files with 28 additions and 0 deletions

View file

@ -2621,3 +2621,27 @@ def test_ap_wps_iteration_error(dev, apdev):
if ev is None: if ev is None:
raise Exception("No WPS-CRED-RECEIVED for the second AP") raise Exception("No WPS-CRED-RECEIVED for the second AP")
dev[0].wait_connected(timeout=15) dev[0].wait_connected(timeout=15)
def test_ap_wps_priority(dev, apdev):
"""WPS PIN provisioning with configured AP and wps_priority"""
ssid = "test-wps-conf-pin"
hostapd.add_ap(apdev[0]['ifname'],
{ "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
"wpa_key_mgmt": "WPA-PSK", "rsn_pairwise": "CCMP"})
hapd = hostapd.Hostapd(apdev[0]['ifname'])
logger.info("WPS provisioning step")
pin = dev[0].wps_read_pin()
hapd.request("WPS_PIN any " + pin)
dev[0].scan_for_bss(apdev[0]['bssid'], freq="2412")
dev[0].dump_monitor()
try:
dev[0].request("SET wps_priority 6")
dev[0].request("WPS_PIN %s %s" % (apdev[0]['bssid'], pin))
dev[0].wait_connected(timeout=30)
netw = dev[0].list_networks()
prio = dev[0].get_network(netw[0]['id'], 'priority')
if prio != '6':
raise Exception("Unexpected network priority: " + prio)
finally:
dev[0].request("SET wps_priority 0")

View file

@ -27,6 +27,8 @@ def check_config(config):
raise Exception("Missing cred") raise Exception("Missing cred")
if "network={" not in data: if "network={" not in data:
raise Exception("Missing network") raise Exception("Missing network")
if "wps_priority=5\n" not in data:
raise Exception("Missing wps_priority")
return data return data
def test_wpas_config_file(dev): def test_wpas_config_file(dev):
@ -57,6 +59,8 @@ def test_wpas_config_file(dev):
wpas.interface_add("wlan5", config=config) wpas.interface_add("wlan5", config=config)
wpas.request("SET wps_priority 5")
id = wpas.add_network() id = wpas.add_network()
wpas.set_network_quoted(id, "ssid", "foo") wpas.set_network_quoted(id, "ssid", "foo")
wpas.set_network_quoted(id, "psk", "12345678") wpas.set_network_quoted(id, "psk", "12345678")