]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: P2P and avoid frequencies driver event on 5 GHz
authorJouni Malinen <jouni@codeaurora.org>
Fri, 15 Jun 2018 18:56:21 +0000 (21:56 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 18 Jun 2018 17:11:52 +0000 (20:11 +0300)
This test case verifies that wpa_supplicant is able to perform CSA to a
VHT80 channel when having to move the GO due to an avoid-frequencies
driver event.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/p2p_utils.py
tests/hwsim/test_p2p_channel.py

index 6c718342894d8c59696a6795a8e4a2b6d110b22b..f72865253b701e5d6e9fa8098d954db0569c240b 100644 (file)
@@ -179,9 +179,9 @@ def invite_from_cli(go, cli, terminate=True):
         terminate_group(go, cli)
     return [go_res, cli_res]
 
-def invite_from_go(go, cli, terminate=True):
+def invite_from_go(go, cli, terminate=True, extra=None):
     logger.info("Re-invoke persistent group from GO")
-    invite(go, cli)
+    invite(go, cli, extra=extra)
     [go_res, cli_res] = check_result(go, cli)
     hwsim_utils.test_connectivity_p2p(go, cli)
     if terminate:
index ffdea2ed5d3ec76896c1e48c7d54a633d05b78c4..316f6b6a3675b5f24ab49294064c9fb77d48a74e 100644 (file)
@@ -190,6 +190,68 @@ def test_p2p_channel_avoid(dev):
         dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
         dev[1].flush_scan_cache()
 
+def test_p2p_channel_avoid2(dev):
+    """P2P and avoid frequencies driver event on 5 GHz"""
+    try:
+        set_country("US", dev[0])
+        [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15,
+                                               r_dev=dev[1], r_intent=0,
+                                               test_data=False,
+                                               i_max_oper_chwidth=80,
+                                               i_ht40=True, i_vht=True)
+        check_grpform_results(i_res, r_res)
+        freq = int(i_res['freq'])
+        if freq < 5000:
+            raise Exception("Unexpected channel %d MHz" % freq)
+
+        if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES " + str(freq)):
+            raise Exception("Could not simulate driver event(2)")
+        ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
+        if ev is None:
+            raise Exception("No CTRL-EVENT-AVOID-FREQ event")
+        ev = dev[0].wait_group_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10)
+        if ev is None:
+            raise Exception("No channel switch event seen")
+        if "ch_width=80 MHz" not in ev:
+            raise Exception("Could not move to a VHT80 channel")
+        ev = dev[0].wait_group_event(["AP-CSA-FINISHED"], timeout=1)
+        if ev is None:
+            raise Exception("No AP-CSA-FINISHED event seen")
+    finally:
+        set_country("00")
+        dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
+        dev[1].flush_scan_cache()
+
+def test_p2p_channel_avoid3(dev):
+    """P2P and avoid frequencies driver event on 5 GHz"""
+    try:
+        set_country("CN", dev[0])
+        form(dev[0], dev[1])
+        set_country("CN", dev[0])
+        [i_res, r_res] = invite_from_go(dev[0], dev[1], terminate=False,
+                                        extra="ht40 vht")
+        freq = int(i_res['freq'])
+        if freq < 5000:
+            raise Exception("Unexpected channel %d MHz" % freq)
+
+        if "OK" not in dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES 5180-5320,5500-5640"):
+            raise Exception("Could not simulate driver event(2)")
+        ev = dev[0].wait_event(["CTRL-EVENT-AVOID-FREQ"], timeout=10)
+        if ev is None:
+            raise Exception("No CTRL-EVENT-AVOID-FREQ event")
+        ev = dev[0].wait_group_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10)
+        if ev is None:
+            raise Exception("No channel switch event seen")
+        if "ch_width=80 MHz" not in ev:
+            raise Exception("Could not move to a VHT80 channel")
+        ev = dev[0].wait_group_event(["AP-CSA-FINISHED"], timeout=1)
+        if ev is None:
+            raise Exception("No AP-CSA-FINISHED event seen")
+    finally:
+        set_country("00")
+        dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
+        dev[1].flush_scan_cache()
+
 @remote_compatible
 def test_autogo_following_bss(dev, apdev):
     """P2P autonomous GO operate on the same channel as station interface"""