]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Channel switch started/completed events
authorJouni Malinen <j@w1.fi>
Mon, 22 Apr 2019 18:03:07 +0000 (21:03 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 22 Apr 2019 19:08:07 +0000 (22:08 +0300)
Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_csa.py
tests/hwsim/test_ap_vht.py

index 662fc22830e8551af51705129f0aceea02a8613a..688055ef8c905f809a7b300155800912515e439c 100644 (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")
index cd98539e986f0bad5201811c654b363c16ddcc1a..3fb7672eaf07e272ad4ba83627cfbe35ff5d21ff 100644 (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")