[PATCH] tests: add a test for mesh forwarding
Johannes Berg
johannes at sipsolutions.net
Wed Jan 11 00:44:07 PST 2017
From: Johannes Berg <johannes.berg at intel.com>
Add a new test that tests connectivity between two stations that
can't reach each other directly in the mesh, but need forwarding
on another station to talk to each other.
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
tests/hwsim/hwsim_utils.py | 8 ++++++++
tests/hwsim/test_wpas_mesh.py | 23 +++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index b2a5814ab779..c74af2f8aa4d 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -187,3 +187,11 @@ def set_powersave(dev, val):
(res, data) = dev.cmd_execute(["echo", data, ">", fname], shell=True)
if res != 0:
raise Exception("Failed to set power save for device")
+
+def set_group_map(dev, val):
+ phy = dev.get_driver_status_field("phyname")
+ fname = '/sys/kernel/debug/ieee80211/%s/hwsim/group' % phy
+ data = '%d' % val
+ (res, data) = dev.cmd_execute(["echo", data, ">", fname], shell=True)
+ if res != 0:
+ raise Exception("Failed to set group map for %s" % phy)
diff --git a/tests/hwsim/test_wpas_mesh.py b/tests/hwsim/test_wpas_mesh.py
index 6ea79fceb4d1..9ff85a619bec 100644
--- a/tests/hwsim/test_wpas_mesh.py
+++ b/tests/hwsim/test_wpas_mesh.py
@@ -17,6 +17,7 @@ from wpasupplicant import WpaSupplicant
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
def check_mesh_support(dev, secure=False):
if "MESH" not in dev.get_capability("modes"):
@@ -2034,3 +2035,25 @@ def test_mesh_select_network(dev):
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
hwsim_utils.test_connectivity(dev[0], dev[1])
+
+def test_mesh_forwarding(dev):
+ """Mesh with two stations that can't reach each other directly"""
+ try:
+ set_group_map(dev[0], 1)
+ set_group_map(dev[1], 3)
+ set_group_map(dev[2], 2)
+ check_mesh_support(dev[0])
+ for i in range(3):
+ add_open_mesh_network(dev[i])
+ check_mesh_group_added(dev[i])
+ for i in range(3):
+ check_mesh_peer_connected(dev[i])
+
+ hwsim_utils.test_connectivity(dev[0], dev[1])
+ hwsim_utils.test_connectivity(dev[1], dev[2])
+ hwsim_utils.test_connectivity(dev[0], dev[2])
+ finally:
+ # reset groups
+ set_group_map(dev[0], 1)
+ set_group_map(dev[1], 1)
+ set_group_map(dev[2], 1)
--
2.9.3
More information about the Hostap
mailing list