tests: Speed up fst_proto by waiting for MGMT-TX-STATUS event

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-07-18 19:04:55 +03:00
parent a55ebeac26
commit 6b294e57a5

View file

@ -1792,6 +1792,14 @@ FST_ACTION_ACK_REQUEST = 3
FST_ACTION_ACK_RESPONSE = 4 FST_ACTION_ACK_RESPONSE = 4
FST_ACTION_ON_CHANNEL_TUNNEL = 5 FST_ACTION_ON_CHANNEL_TUNNEL = 5
def hostapd_tx_and_status(hapd, msg):
hapd.set("ext_mgmt_frame_handling", "1")
hapd.mgmt_tx(msg)
ev = hapd.wait_event([ "MGMT-TX-STATUS" ], timeout=1)
if ev is None or "ok=1" not in ev:
raise Exception("No ACK")
hapd.set("ext_mgmt_frame_handling", "0")
def test_fst_proto(dev, apdev, test_params): def test_fst_proto(dev, apdev, test_params):
"""FST protocol testing""" """FST protocol testing"""
ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev) ap1, ap2, sta1, sta2 = fst_module_aux.start_two_ap_sta_pairs(apdev)
@ -1810,21 +1818,18 @@ def test_fst_proto(dev, apdev, test_params):
# unknown FST Action (255) received! # unknown FST Action (255) received!
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, 255) msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, 255)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# FST Request dropped: too short # FST Request dropped: too short
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_SETUP_REQUEST) FST_ACTION_SETUP_REQUEST)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# FST Request dropped: new and old band IDs are the same # FST Request dropped: new and old band IDs are the same
msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST,
FST_ACTION_SETUP_REQUEST, 0, 0, FST_ACTION_SETUP_REQUEST, 0, 0,
164, 11, 0, 0, 0, 0, 0, 0, 0, 0) 164, 11, 0, 0, 0, 0, 0, 0, 0, 0)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
ifaces = sta1.list_ifaces() ifaces = sta1.list_ifaces()
id = int(ifaces[0]['name'].split('|')[1]) id = int(ifaces[0]['name'].split('|')[1])
@ -1832,13 +1837,12 @@ def test_fst_proto(dev, apdev, test_params):
msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST,
FST_ACTION_SETUP_REQUEST, 0, 0, FST_ACTION_SETUP_REQUEST, 0, 0,
164, 11, 0, 0, id + 1, 0, 0, 0, 0, 0) 164, 11, 0, 0, id + 1, 0, 0, 0, 0, 0)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# FST Action 'Setup Response' dropped: no session in progress found # FST Action 'Setup Response' dropped: no session in progress found
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_SETUP_RESPONSE) FST_ACTION_SETUP_RESPONSE)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
# Create session # Create session
initiator = ap1 initiator = ap1
@ -1855,46 +1859,39 @@ def test_fst_proto(dev, apdev, test_params):
# FST Response dropped due to wrong state: SETUP_COMPLETION # FST Response dropped due to wrong state: SETUP_COMPLETION
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_SETUP_RESPONSE) FST_ACTION_SETUP_RESPONSE)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# Too short FST Tear Down dropped # Too short FST Tear Down dropped
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_TEAR_DOWN) FST_ACTION_TEAR_DOWN)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# tear down for wrong FST Setup ID (0) # tear down for wrong FST Setup ID (0)
msg['payload'] = struct.pack("<BBL", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BBL", ACTION_CATEG_FST,
FST_ACTION_TEAR_DOWN, 0) FST_ACTION_TEAR_DOWN, 0)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# Ack received on wrong interface # Ack received on wrong interface
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_ACK_REQUEST) FST_ACTION_ACK_REQUEST)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# Ack Response in inappropriate session state (SETUP_COMPLETION) # Ack Response in inappropriate session state (SETUP_COMPLETION)
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_ACK_RESPONSE) FST_ACTION_ACK_RESPONSE)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# Unsupported FST Action frame (On channel tunnel) # Unsupported FST Action frame (On channel tunnel)
msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_ON_CHANNEL_TUNNEL) FST_ACTION_ON_CHANNEL_TUNNEL)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
# FST Request dropped: new iface not found (new_band_id match) # FST Request dropped: new iface not found (new_band_id match)
# FST Request dropped due to MAC comparison # FST Request dropped due to MAC comparison
msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST,
FST_ACTION_SETUP_REQUEST, 0, 0, FST_ACTION_SETUP_REQUEST, 0, 0,
164, 11, 0, 0, id, 0, 0, 0, 0, 0) 164, 11, 0, 0, id, 0, 0, 0, 0, 0)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
time.sleep(0.1)
hapd2 = ap2.get_instance() hapd2 = ap2.get_instance()
dst2 = sta2.get_instance().own_addr() dst2 = sta2.get_instance().own_addr()
@ -1908,8 +1905,7 @@ def test_fst_proto(dev, apdev, test_params):
# FST Response dropped: wlan6 is not the old iface # FST Response dropped: wlan6 is not the old iface
msg2['payload'] = struct.pack("<BB", ACTION_CATEG_FST, msg2['payload'] = struct.pack("<BB", ACTION_CATEG_FST,
FST_ACTION_SETUP_RESPONSE) FST_ACTION_SETUP_RESPONSE)
hapd2.mgmt_tx(msg2) hostapd_tx_and_status(hapd2, msg2)
time.sleep(0.1)
sta.dump_monitor() sta.dump_monitor()
@ -1924,7 +1920,7 @@ def test_fst_proto(dev, apdev, test_params):
msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST, msg['payload'] = struct.pack("<BBBLBBLBBBBBBB", ACTION_CATEG_FST,
FST_ACTION_SETUP_REQUEST, 0, 0, FST_ACTION_SETUP_REQUEST, 0, 0,
164, 11, 0, 0, id, 0, 0, 0, 0, 0) 164, 11, 0, 0, id, 0, 0, 0, 0, 0)
hapd.mgmt_tx(msg) hostapd_tx_and_status(hapd, msg)
finally: finally:
fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2) fst_module_aux.disconnect_two_ap_sta_pairs(ap1, ap2, sta1, sta2)
try: try: