[2/2] tests: Add a mesh DFS test

Submitted by Masashi Honma on April 10, 2017, 2:55 a.m.

Details

Message ID 1491792947-29720-2-git-send-email-masashi.honma@gmail.com
State New
Headers show

Commit Message

Masashi Honma April 10, 2017, 2:55 a.m.
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 tests/hwsim/test_wpas_mesh.py | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index 469fe01..4f03e25 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -18,6 +18,8 @@  from utils import HwsimSkip, alloc_fail, fail_test, wait_fail_trigger
 from tshark import run_tshark
 from test_ap_ht import set_world_reg
 from hwsim_utils import set_group_map
+from test_dfs import wait_dfs_event
+from test_p2p_channel import set_country
 
 def check_mesh_support(dev, secure=False):
     if "MESH" not in dev.get_capability("modes"):
@@ -1036,6 +1038,47 @@  def _test_mesh_open_vht_160(dev, apdev):
     dev[0].dump_monitor()
     dev[1].dump_monitor()
 
+def test_wpas_mesh_open_dfs(dev, apdev):
+    """wpa_supplicant open MESH network with DFS"""
+    try:
+        _test_wpas_mesh_open_dfs(dev, apdev)
+    finally:
+        for i in range(0, 2):
+            dev[i].mesh_group_remove()
+            check_mesh_group_removed(dev[i])
+            dev[i].flush_scan_cache()
+            dev[i].dump_monitor()
+        set_country("00")
+
+def _test_wpas_mesh_open_dfs(dev, apdev):
+    set_country("US")
+    for i in range(0, 2):
+        dev[i].request("SET country US")
+        check_mesh_support(dev[i])
+        add_open_mesh_network(dev[i], freq="5260", basic_rates="60 120 240",
+                              disable_ht40=True)
+
+        ev = wait_dfs_event(dev[i], "DFS-CAC-START", 5)
+        if "DFS-CAC-START" not in ev:
+            # For now, assume DFS is not supported by all kernel builds.
+            raise HwsimSkip("CAC did not start - assume not supported")
+
+        ev = wait_dfs_event(dev[i], "DFS-CAC-COMPLETED", 70)
+        if "success=1" not in ev:
+            raise Exception("CAC failed")
+        if "freq=5260" not in ev:
+            raise Exception("Unexpected DFS freq result")
+
+        # Check for mesh joined
+        check_mesh_group_added(dev[i])
+
+    # Check for peer connected
+    for i in range(0, 2):
+        check_mesh_peer_connected(dev[i])
+
+    # Test connectivity 0->1 and 1->0
+    hwsim_utils.test_connectivity(dev[0], dev[1])
+
 def test_wpas_mesh_password_mismatch(dev, apdev):
     """Mesh network and one device with mismatching password"""
     check_mesh_support(dev[0], secure=True)