tests: Channel switch started/completed events

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-04-22 21:03:07 +03:00
parent fa335929b7
commit 64c20a831f
2 changed files with 29 additions and 0 deletions

View File

@ -23,6 +23,19 @@ def connect(dev, apdev, **kwargs):
def switch_channel(ap, count, freq):
ap.request("CHAN_SWITCH " + str(count) + " " + str(freq))
ev = ap.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10)
if ev is None:
raise Exception("Channel switch start event not seen")
if "freq=" + str(freq) not in ev:
raise Exception("Unexpected channel in CS started event")
ev = ap.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10)
if ev is None:
raise Exception("Channel switch completed event not seen")
if "freq=" + str(freq) not in ev:
raise Exception("Unexpected channel in CS completed event")
ev = ap.wait_event(["AP-CSA-FINISHED"], timeout=10)
if ev is None:
raise Exception("CSA finished event timed out")
@ -30,6 +43,12 @@ def switch_channel(ap, count, freq):
raise Exception("Unexpected channel in CSA finished event")
def wait_channel_switch(dev, freq):
ev = dev.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=5)
if ev is None:
raise Exception("Channel switch start not reported")
if "freq=%d" % freq not in ev:
raise Exception("Unexpected frequency in channel switch started: " + ev)
ev = dev.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=5)
if ev is None:
raise Exception("Channel switch not reported")

View File

@ -742,6 +742,16 @@ def test_ap_vht80_csa(dev, apdev):
hwsim_utils.test_connectivity(dev[0], hapd)
hapd.request("CHAN_SWITCH 5 5180 ht vht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80")
ev = hapd.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10)
if ev is None:
raise Exception("Channel switch start event not seen")
if "freq=5180" not in ev:
raise Exception("Unexpected channel in CS started")
ev = hapd.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10)
if ev is None:
raise Exception("Channel switch completion event not seen")
if "freq=5180" not in ev:
raise Exception("Unexpected channel in CS completed")
ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10)
if ev is None:
raise Exception("CSA finished event timed out")