def _test_wmediumd_path_ttl(dev, ok): for i in range(0, 5): check_mesh_support(dev[i]) add_open_mesh_network(dev[i], freq="2462", basic_rates="60 120 240") # Check for mesh joined for i in range(0, 5): check_mesh_group_added(dev[i]) state = dev[i].get_status_field("wpa_state") if state != "COMPLETED": raise Exception("Unexpected wpa_state on dev" + str(i) + ": " + state) mode = dev[i].get_status_field("mode") if mode != "mesh": raise Exception("Unexpected mode: " + mode) # set mesh path request ttl subprocess.check_call([ "iw", "dev", dev[0].ifname, "set", "mesh_param", "mesh_element_ttl=" + ("4" if ok else "3") ]) # Check for peer connected for i in range(0, 5): check_mesh_peer_connected(dev[i]) for i in range(1, 4): check_mesh_peer_connected(dev[i]) # Test connectivity 0->4 and 0->4 hwsim_utils.test_connectivity(dev[0], dev[4], success_expected=ok) # Check mpath table on 0 res, data = dev[0].cmd_execute(['iw', dev[0].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev0") if ok: if data.find(dev[1].own_addr() + ' ' + dev[1].own_addr()) == -1 or \ data.find(dev[4].own_addr() + ' ' + dev[1].own_addr()) == -1: raise Exception("mpath not found on dev0:\n" + data) else: if data.find(dev[1].own_addr() + ' ' + dev[1].own_addr()) == -1 or \ data.find(dev[4].own_addr() + ' 00:00:00:00:00:00') == -1: raise Exception("mpath not found on dev0:\n" + data) if data.find(dev[0].own_addr()) > -1 or \ data.find(dev[2].own_addr()) > -1 or \ data.find(dev[3].own_addr()) > -1: raise Exception("invalid mpath found on dev0:\n" + data) # remove mesh groups for i in range(0, 3): dev[i].mesh_group_remove() check_mesh_group_removed(dev[i]) dev[i].dump_monitor()
def _test_wmediumd_path_rann(dev, apdev): for i in range(0, 3): check_mesh_support(dev[i]) add_open_mesh_network(dev[i], freq="2462", basic_rates="60 120 240") # Check for mesh joined for i in range(0, 3): check_mesh_group_added(dev[i]) state = dev[i].get_status_field("wpa_state") if state != "COMPLETED": raise Exception("Unexpected wpa_state on dev" + str(i) + ": " + state) mode = dev[i].get_status_field("mode") if mode != "mesh": raise Exception("Unexpected mode: " + mode) # set node 2 as RANN supported root subprocess.check_call([ "iw", "dev", dev[0].ifname, "set", "mesh_param", "mesh_hwmp_rootmode=0" ]) subprocess.check_call([ "iw", "dev", dev[1].ifname, "set", "mesh_param", "mesh_hwmp_rootmode=0" ]) subprocess.check_call([ "iw", "dev", dev[2].ifname, "set", "mesh_param", "mesh_hwmp_rootmode=4" ]) subprocess.check_call([ "iw", "dev", dev[2].ifname, "set", "mesh_param", "mesh_hwmp_rann_interval=2000" ]) # 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]) # Wait for RANN frame time.sleep(10) # Test connectivity 1->2 and 2->1 hwsim_utils.test_connectivity(dev[1], dev[2]) # Check mpath table on 0 res, data = dev[0].cmd_execute(['iw', dev[0].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev0") if data.find(dev[1].own_addr() + ' ' + dev[1].own_addr()) == -1 or \ data.find(dev[2].own_addr() + ' ' + dev[2].own_addr()) == -1: raise Exception("mpath not found on dev0:\n" + data) if data.find(dev[0].own_addr()) > -1: raise Exception("invalid mpath found on dev0:\n" + data) # Check mpath table on 1 res, data = dev[1].cmd_execute(['iw', dev[1].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev1") if data.find(dev[0].own_addr() + ' ' + dev[0].own_addr()) == -1 or \ data.find(dev[2].own_addr() + ' ' + dev[0].own_addr()) == -1: raise Exception("mpath not found on dev1:\n" + data) if data.find(dev[2].own_addr() + ' ' + dev[2].own_addr()) > -1 or \ data.find(dev[1].own_addr()) > -1: raise Exception("invalid mpath found on dev1:\n" + data) # Check mpath table on 2 res, data = dev[2].cmd_execute(['iw', dev[2].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev2") if data.find(dev[0].own_addr() + ' ' + dev[0].own_addr()) == -1 or \ data.find(dev[1].own_addr() + ' ' + dev[0].own_addr()) == -1: raise Exception("mpath not found on dev2:\n" + data) if data.find(dev[1].own_addr() + ' ' + dev[1].own_addr()) > -1 or \ data.find(dev[2].own_addr()) > -1: raise Exception("invalid mpath found on dev2:\n" + data) # remove mesh groups for i in range(0, 3): dev[i].mesh_group_remove() check_mesh_group_removed(dev[i]) dev[i].dump_monitor()
def _test_wmediumd_path_simple(dev, apdev): for i in range(0, 3): check_mesh_support(dev[i]) add_open_mesh_network(dev[i], freq="2462", basic_rates="60 120 240") # Check for mesh joined for i in range(0, 3): check_mesh_group_added(dev[i]) state = dev[i].get_status_field("wpa_state") if state != "COMPLETED": raise Exception("Unexpected wpa_state on dev" + str(i) + ": " + state) mode = dev[i].get_status_field("mode") if mode != "mesh": raise Exception("Unexpected mode: " + mode) # 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]) # Check mpath table on 0 res, data = dev[0].cmd_execute(['iw', dev[0].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev0") if data.find(dev[1].own_addr() + ' ' + dev[1].own_addr()) == -1 or \ data.find(dev[2].own_addr() + ' ' + dev[2].own_addr()) == -1: raise Exception("mpath not found on dev0:\n" + data) if data.find(dev[0].own_addr()) > -1: raise Exception("invalid mpath found on dev0:\n" + data) # Check mpath table on 1 res, data = dev[1].cmd_execute(['iw', dev[1].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev1") if data.find(dev[0].own_addr() + ' ' + dev[0].own_addr()) == -1 or \ data.find(dev[2].own_addr() + ' ' + dev[0].own_addr()) == -1: raise Exception("mpath not found on dev1:\n" + data) if data.find(dev[2].own_addr() + ' ' + dev[2].own_addr()) > -1 or \ data.find(dev[1].own_addr()) > -1: raise Exception("invalid mpath found on dev1:\n" + data) # Check mpath table on 2 res, data = dev[2].cmd_execute(['iw', dev[2].ifname, 'mpath', 'dump']) if res != 0: raise Exception("iw command failed on dev2") if data.find(dev[0].own_addr() + ' ' + dev[0].own_addr()) == -1 or \ data.find(dev[1].own_addr() + ' ' + dev[0].own_addr()) == -1: raise Exception("mpath not found on dev2:\n" + data) if data.find(dev[1].own_addr() + ' ' + dev[1].own_addr()) > -1 or \ data.find(dev[2].own_addr()) > -1: raise Exception("invalid mpath found on dev2:\n" + data) # remove mesh groups for i in range(0, 3): dev[i].mesh_group_remove() check_mesh_group_removed(dev[i]) dev[i].dump_monitor()