tests: Make ap_vht_csa_vht40_disable more robust

Wait for disconnection and reconnection after CSA since mac80211 does
not support clean CSA to disable VHT.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-04-03 21:16:06 +03:00
parent c7a9a5745b
commit ca70f36c20

View file

@ -889,7 +889,7 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
hapd = hostapd.add_ap(apdev[0], params) hapd = hostapd.add_ap(apdev[0], params)
bssid = hapd.own_addr() bssid = hapd.own_addr()
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745") dev[0].connect("vht", key_mgmt="NONE", scan_freq="5200 5745")
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
hapd.request("CHAN_SWITCH 5 5200 center_freq1=5210 sec_channel_offset=1 bandwidth=40 ht") hapd.request("CHAN_SWITCH 5 5200 center_freq1=5210 sec_channel_offset=1 bandwidth=40 ht")
@ -903,7 +903,14 @@ def test_ap_vht_csa_vht40_disable(dev, apdev):
raise Exception("Channel switch event not seen") raise Exception("Channel switch event not seen")
if "freq=5200" not in ev: if "freq=5200" not in ev:
raise Exception("Channel mismatch: " + ev) raise Exception("Channel mismatch: " + ev)
time.sleep(0.5) ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=5)
if ev:
# mac80211 does not support CSA to disable VHT, so the channel
# switch will be followed by disconnection and attempt to reconnect.
# Wait for that here to avoid failing the test case based on how
# example the connectivity test would get timed compared to getting
# disconnected or reconnected.
dev[0].wait_connected()
hwsim_utils.test_connectivity(dev[0], hapd) hwsim_utils.test_connectivity(dev[0], hapd)
dev[1].connect("vht", key_mgmt="NONE", scan_freq="5200") dev[1].connect("vht", key_mgmt="NONE", scan_freq="5200")