tests: Clean up ap_wpa2_eap_aka_ext
Use a loop over set of test values instead of duplicated functionality implemented separately for each case. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
584e4197bd
commit
0258cf1006
1 changed files with 24 additions and 118 deletions
|
@ -560,23 +560,6 @@ def _test_ap_wpa2_eap_aka_ext(dev, apdev):
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
dev[0].wait_disconnected()
|
dev[0].wait_disconnected()
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
|
||||||
p = ev.split(':', 2)
|
|
||||||
if p[1] != "UMTS-AUTH":
|
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
|
||||||
rid = p[0].split('-')[3]
|
|
||||||
# This will fail during UMTS auth validation
|
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:" + resp):
|
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("EAP failure not reported")
|
|
||||||
dev[0].request("DISCONNECT")
|
|
||||||
dev[0].wait_disconnected()
|
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
dev[0].select_network(id, freq="2412")
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
if ev is None:
|
if ev is None:
|
||||||
|
@ -604,107 +587,30 @@ def _test_ap_wpa2_eap_aka_ext(dev, apdev):
|
||||||
dev[0].request("DISCONNECT")
|
dev[0].request("DISCONNECT")
|
||||||
dev[0].wait_disconnected()
|
dev[0].wait_disconnected()
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
tests = [ ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:0011223344",
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
":UMTS-AUTH:34",
|
||||||
if ev is None:
|
":UMTS-AUTH:00112233445566778899aabbccddeeff.00112233445566778899aabbccddeeff:0011223344",
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddee:0011223344",
|
||||||
p = ev.split(':', 2)
|
":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff.0011223344",
|
||||||
if p[1] != "UMTS-AUTH":
|
":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff0011223344",
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:001122334q" ]
|
||||||
rid = p[0].split('-')[3]
|
for t in tests:
|
||||||
# This will fail during UMTS auth validation
|
dev[0].select_network(id, freq="2412")
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:34"):
|
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
if ev is None:
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
raise Exception("Wait for external SIM processing request timed out")
|
||||||
if ev is None:
|
p = ev.split(':', 2)
|
||||||
raise Exception("EAP failure not reported")
|
if p[1] != "UMTS-AUTH":
|
||||||
dev[0].request("DISCONNECT")
|
raise Exception("Unexpected CTRL-REQ-SIM type")
|
||||||
dev[0].wait_disconnected()
|
rid = p[0].split('-')[3]
|
||||||
|
# This will fail during UMTS auth validation
|
||||||
dev[0].select_network(id, freq="2412")
|
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + t):
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
raise Exception("CTRL-RSP-SIM failed")
|
||||||
if ev is None:
|
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
if ev is None:
|
||||||
p = ev.split(':', 2)
|
raise Exception("EAP failure not reported")
|
||||||
if p[1] != "UMTS-AUTH":
|
dev[0].request("DISCONNECT")
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
dev[0].wait_disconnected()
|
||||||
rid = p[0].split('-')[3]
|
|
||||||
# This will fail during UMTS auth validation
|
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:00112233445566778899aabbccddeeff.00112233445566778899aabbccddeeff:0011223344"):
|
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("EAP failure not reported")
|
|
||||||
dev[0].request("DISCONNECT")
|
|
||||||
dev[0].wait_disconnected()
|
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
|
||||||
p = ev.split(':', 2)
|
|
||||||
if p[1] != "UMTS-AUTH":
|
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
|
||||||
rid = p[0].split('-')[3]
|
|
||||||
# This will fail during UMTS auth validation
|
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddee:0011223344"):
|
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("EAP failure not reported")
|
|
||||||
dev[0].request("DISCONNECT")
|
|
||||||
dev[0].wait_disconnected()
|
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
|
||||||
p = ev.split(':', 2)
|
|
||||||
if p[1] != "UMTS-AUTH":
|
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
|
||||||
rid = p[0].split('-')[3]
|
|
||||||
# This will fail during UMTS auth validation
|
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff.0011223344"):
|
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("EAP failure not reported")
|
|
||||||
dev[0].request("DISCONNECT")
|
|
||||||
dev[0].wait_disconnected()
|
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
|
||||||
p = ev.split(':', 2)
|
|
||||||
if p[1] != "UMTS-AUTH":
|
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
|
||||||
rid = p[0].split('-')[3]
|
|
||||||
# This will fail during UMTS auth validation
|
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff0011223344"):
|
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("EAP failure not reported")
|
|
||||||
dev[0].request("DISCONNECT")
|
|
||||||
dev[0].wait_disconnected()
|
|
||||||
|
|
||||||
dev[0].select_network(id, freq="2412")
|
|
||||||
ev = dev[0].wait_event(["CTRL-REQ-SIM"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("Wait for external SIM processing request timed out")
|
|
||||||
p = ev.split(':', 2)
|
|
||||||
if p[1] != "UMTS-AUTH":
|
|
||||||
raise Exception("Unexpected CTRL-REQ-SIM type")
|
|
||||||
rid = p[0].split('-')[3]
|
|
||||||
# This will fail during UMTS auth validation
|
|
||||||
if "OK" not in dev[0].request("CTRL-RSP-SIM-" + rid + ":UMTS-AUTH:00112233445566778899aabbccddeeff:00112233445566778899aabbccddeeff:001122334q"):
|
|
||||||
raise Exception("CTRL-RSP-SIM failed")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-EAP-FAILURE"], timeout=15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("EAP failure not reported")
|
|
||||||
dev[0].request("DISCONNECT")
|
|
||||||
dev[0].wait_disconnected()
|
|
||||||
|
|
||||||
def test_ap_wpa2_eap_aka_prime(dev, apdev):
|
def test_ap_wpa2_eap_aka_prime(dev, apdev):
|
||||||
"""WPA2-Enterprise connection using EAP-AKA'"""
|
"""WPA2-Enterprise connection using EAP-AKA'"""
|
||||||
|
|
Loading…
Reference in a new issue