Signed-off-by: Masashi Honma <masashi.honma@xxxxxxxxx> --- tests/hwsim/test_wmediumd.py | 82 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/test_wmediumd.py b/tests/hwsim/test_wmediumd.py index 42cb9c9..75d6383 100644 --- a/tests/hwsim/test_wmediumd.py +++ b/tests/hwsim/test_wmediumd.py @@ -4,9 +4,11 @@ # This software may be distributed under the terms of the BSD license. # See README for more details. -import tempfile, os, subprocess, errno +import tempfile, os, subprocess, errno, hwsim_utils from utils import HwsimSkip from test_ap_open import _test_ap_open +from test_wpas_mesh import check_mesh_support, check_mesh_group_added +from test_wpas_mesh import check_mesh_peer_connected, add_open_mesh_network CFG = """ ifaces : @@ -18,6 +20,23 @@ ifaces : }; """ +CFG2 = """ +ifaces : +{ + ids = [ + "02:00:00:00:00:00", + "02:00:00:00:01:00", + "02:00:00:00:02:00" + ]; + + links = ( + (0, 1, 50), + (0, 2, 50), + (1, 2, -10) + ); +}; +""" + def test_wmediumd_simple(dev, apdev, params): """test a simple wmediumd configuration""" fd, fn = tempfile.mkstemp() @@ -42,3 +61,64 @@ def test_wmediumd_simple(dev, apdev, params): _test_ap_open(dev, apdev) finally: os.unlink(fn) + +def test_wmediumd_path(dev, apdev, params): + """test a mesh path""" + # 0 and 1 is connected + # 0 and 2 is connected + # 1 and 2 is not connected + # 1 --- 0 --- 2 + # | | + # +-----X-----+ + # This tests if 1 and 2 can communicate each other via 0. + fd, fn = tempfile.mkstemp() + try: + f = os.fdopen(fd, 'w') + f.write(CFG2) + f.close() + try: + p = subprocess.Popen(['wmediumd', '-l', '6', '-c', fn], + stdout=open(os.path.abspath(os.path.join(params['logdir'], 'wmediumd.log')), 'a'), + stderr=subprocess.STDOUT) + except OSError, e: + if e.errno == errno.ENOENT: + raise HwsimSkip("wmediumd not available") + raise + try: + _test_wmediumd_path(dev, apdev) + finally: + p.terminate() + p.wait() + finally: + os.unlink(fn) + +def _test_wmediumd_path(dev, apdev): + check_mesh_support(dev[0]) + add_open_mesh_network(dev[0], freq="2462", basic_rates="60 120 240") + add_open_mesh_network(dev[1], freq="2462", basic_rates="60 120 240") + add_open_mesh_network(dev[2], freq="2462", basic_rates="60 120 240") + + # Check for mesh joined + check_mesh_group_added(dev[0]) + check_mesh_group_added(dev[1]) + check_mesh_group_added(dev[2]) + + # Check for peer connected + check_mesh_peer_connected(dev[0]) + check_mesh_peer_connected(dev[0]) + check_mesh_peer_connected(dev[1]) + check_mesh_peer_connected(dev[2]) + + # Test connectivity 1->2 and 2->1 + hwsim_utils.test_connectivity(dev[1], dev[2]) + + state = dev[0].get_status_field("wpa_state") + if state != "COMPLETED": + raise Exception("Unexpected wpa_state on dev0: " + state) + state = dev[1].get_status_field("wpa_state") + if state != "COMPLETED": + raise Exception("Unexpected wpa_state on dev1: " + state) + + mode = dev[0].get_status_field("mode") + if mode != "mesh": + raise Exception("Unexpected mode: " + mode) -- 2.7.4 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap