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

Masashi Honma masashi.honma at gmail.com
Sun Apr 9 19:55:47 PDT 2017


Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
 tests/hwsim/test_wpas_mesh.py | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

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)
-- 
2.7.4




More information about the Hostap mailing list