tests: Add a test for mesh forwarding

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@intel.com>
This commit is contained in:
Johannes Berg 2017-01-11 09:44:07 +01:00 committed by Jouni Malinen
parent f09095d57b
commit f5a270b5dc
2 changed files with 31 additions and 0 deletions

View file

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

View file

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