tests: Reduce mesh result code duplication with helper functions

These checks were repeated in almost every test case, so use helper
functions to get rid of duplicated (copy-pasted) code.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-01-07 00:25:08 +02:00
parent dc1aaa5d07
commit 5d2e9d1cf8

View file

@ -102,6 +102,19 @@ def check_mesh_peer_disconnected(dev):
if ev is None:
raise Exception("Test exception: Peer disconnect event not detected.")
def check_mesh_joined2(dev):
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
def check_mesh_connected2(dev, timeout0=10, connectivity=False):
check_mesh_peer_connected(dev[0], timeout=timeout0)
check_mesh_peer_connected(dev[1])
if connectivity:
hwsim_utils.test_connectivity(dev[0], dev[1])
def check_mesh_joined_connected(dev, connectivity=False, timeout0=10):
check_mesh_joined2(dev)
check_mesh_connected2(dev, timeout0=timeout0, connectivity=connectivity)
def test_wpas_add_set_remove_support(dev):
"""wpa_supplicant MESH add/set/remove network support"""
@ -158,29 +171,14 @@ def test_wpas_mesh_peer_connected(dev):
check_mesh_support(dev[0])
add_open_mesh_network(dev[0], beacon_int=160)
add_open_mesh_network(dev[1], beacon_int=160)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
def test_wpas_mesh_peer_disconnected(dev):
"""wpa_supplicant MESH peer disconnected"""
check_mesh_support(dev[0])
add_open_mesh_network(dev[0])
add_open_mesh_network(dev[1])
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
# Remove group on dev 1
dev[1].mesh_group_remove()
@ -194,9 +192,7 @@ def test_wpas_mesh_mode_scan(dev):
add_open_mesh_network(dev[0])
add_open_mesh_network(dev[1], beacon_int=175)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
# Check for Mesh scan
check_mesh_scan(dev[0], "use_id=1 freq=2412", beacon_int=175)
@ -207,16 +203,7 @@ def test_wpas_mesh_open(dev, apdev):
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")
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
state = dev[0].get_status_field("wpa_state")
if state != "COMPLETED":
@ -241,16 +228,7 @@ def test_wpas_mesh_open_no_auto(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0], timeout=30)
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True, timeout0=30)
def test_mesh_open_no_auto2(dev, apdev):
"""Open mesh network connectivity, no_auto on both peers"""
@ -263,8 +241,7 @@ def test_mesh_open_no_auto2(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
ev = dev[0].wait_event(["will not initiate new peer link"], timeout=10)
if ev is None:
@ -274,8 +251,7 @@ def test_mesh_open_no_auto2(dev, apdev):
raise Exception("MESH_PEER_ADD failed")
if "FAIL" not in dev[0].request("MESH_PEER_ADD ff:ff:ff:ff:ff:ff"):
raise Exception("MESH_PEER_ADD with unknown STA succeeded")
check_mesh_peer_connected(dev[0], timeout=30)
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev, timeout0=30)
if "FAIL" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD succeeded for connected STA")
hwsim_utils.test_connectivity(dev[0], dev[1])
@ -344,16 +320,7 @@ def test_wpas_mesh_secure(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
state = dev[0].get_status_field("wpa_state")
if state != "COMPLETED":
@ -373,13 +340,7 @@ def test_wpas_mesh_secure_sae_password(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_wpas_mesh_secure_sae_password_id(dev, apdev):
"""Secure mesh using sae_password and password identifier"""
@ -394,13 +355,7 @@ def test_wpas_mesh_secure_sae_password_id(dev, apdev):
sae_password_id="pw id")
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_wpas_mesh_secure_sae_password_id_mismatch(dev, apdev):
"""Secure mesh using sae_password and password identifier mismatch"""
@ -415,8 +370,7 @@ def test_wpas_mesh_secure_sae_password_id_mismatch(dev, apdev):
sae_password_id="wrong")
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
ev = dev[0].wait_event(["CTRL-EVENT-SAE-UNKNOWN-PASSWORD-IDENTIFIER"],
timeout=10)
@ -434,16 +388,7 @@ def test_mesh_secure_pmf(dev, apdev):
id = add_mesh_secure_net(dev[1], pmf=True)
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_mesh_secure_ocv(dev, apdev):
"""Secure mesh network connectivity with OCV enabled"""
@ -455,16 +400,7 @@ def test_mesh_secure_ocv(dev, apdev):
id = add_mesh_secure_net(dev[1], pmf=True, ocv=True)
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_mesh_secure_ocv_compat(dev, apdev):
"""Secure mesh network where only one peer has OCV enabled"""
@ -476,16 +412,7 @@ def test_mesh_secure_ocv_compat(dev, apdev):
id = add_mesh_secure_net(dev[1], pmf=True, ocv=False)
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def set_reg(dev, country):
subprocess.call(['iw', 'reg', 'set', country])
@ -528,16 +455,7 @@ def run_mesh_secure_ocv_mix_legacy(dev, apdev):
dev[1].set_network(id, "disable_ht40", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_mesh_secure_ocv_mix_ht(dev, apdev):
"""Mesh network with a VHT STA and a HT STA under OCV"""
@ -562,16 +480,7 @@ def run_mesh_secure_ocv_mix_ht(dev, apdev):
dev[1].set_network(id, "disable_vht", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def run_mesh_secure(dev, cipher):
if cipher not in dev[0].get_capability("pairwise"):
@ -585,16 +494,7 @@ def run_mesh_secure(dev, cipher):
id = add_mesh_secure_net(dev[1], pairwise=cipher, group=cipher)
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_mesh_secure_ccmp(dev, apdev):
"""Secure mesh with CCMP"""
@ -700,11 +600,7 @@ def test_wpas_mesh_secure_sae_group_negotiation(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
dev[0].request("SET sae_groups ")
dev[1].request("SET sae_groups ")
@ -737,16 +633,7 @@ def test_wpas_mesh_secure_no_auto(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0], timeout=30)
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
dev[0].request("SET sae_groups ")
dev[1].request("SET sae_groups ")
@ -764,9 +651,7 @@ def test_wpas_mesh_secure_dropped_frame(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
# Drop the first Action frame (plink Open) to test unexpected order of
# Confirm/Open messages.
@ -786,12 +671,7 @@ def test_wpas_mesh_secure_dropped_frame(dev, apdev):
dev[0].request("SET ext_mgmt_frame_handling 0")
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_connected2(dev, connectivity=True)
def test_mesh_secure_fail(dev, apdev):
"""Secure mesh network connectivity failure"""
@ -806,11 +686,7 @@ def test_mesh_secure_fail(dev, apdev):
with fail_test(dev[0], 1, "wpa_driver_nl80211_sta_add;mesh_mpm_auth_peer"):
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
def test_wpas_mesh_ctrl(dev):
"""wpa_supplicant ctrl_iface mesh command error cases"""
@ -848,11 +724,7 @@ def test_wpas_mesh_dynamic_interface(dev):
add_open_mesh_network(wpas0)
add_open_mesh_network(wpas1)
check_mesh_group_added(wpas0)
check_mesh_group_added(wpas1)
check_mesh_peer_connected(wpas0)
check_mesh_peer_connected(wpas1)
hwsim_utils.test_connectivity(wpas0, wpas1)
check_mesh_joined_connected([wpas0, wpas1], connectivity=True)
# Must not allow MESH_GROUP_REMOVE on dynamic interface
if "FAIL" not in wpas0.request("MESH_GROUP_REMOVE " + mesh0):
@ -894,11 +766,7 @@ def test_wpas_mesh_dynamic_interface(dev):
add_open_mesh_network(wpas0)
add_open_mesh_network(wpas1)
check_mesh_group_added(wpas0)
check_mesh_group_added(wpas1)
check_mesh_peer_connected(wpas0)
check_mesh_peer_connected(wpas1)
hwsim_utils.test_connectivity(wpas0, wpas1)
check_mesh_joined_connected([wpas0, wpas1], connectivity=True)
finally:
if mesh0:
dev[0].request("MESH_GROUP_REMOVE " + mesh0)
@ -918,11 +786,7 @@ def test_wpas_mesh_dynamic_interface_remove(dev):
logger.info(mesh5 + " address " + wpas5.get_status_field("address"))
add_open_mesh_network(wpas5)
add_open_mesh_network(dev[0])
check_mesh_group_added(wpas5)
check_mesh_group_added(dev[0])
check_mesh_peer_connected(wpas5)
check_mesh_peer_connected(dev[0])
hwsim_utils.test_connectivity(wpas5, dev[0])
check_mesh_joined_connected([wpas5, dev[0]], connectivity=True)
# Remove the main interface while mesh interface is in use
wpas.interface_remove("wlan5")
@ -1047,16 +911,7 @@ def _test_wpas_mesh_open_5ghz(dev, apdev):
break
add_open_mesh_network(dev[i], freq="5180")
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
dev[0].mesh_group_remove()
dev[1].mesh_group_remove()
@ -1099,10 +954,7 @@ def _test_wpas_mesh_open_5ghz_coex(dev, apdev):
dev[i].scan_for_bss(bssid, freq=5200)
add_open_mesh_network(dev[i], freq="5180")
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
freq = dev[0].get_status_field("freq")
if freq != "5200":
@ -1190,16 +1042,7 @@ def _test_wpas_mesh_open_vht40(dev, apdev):
break
add_open_mesh_network(dev[i], freq="5180", chwidth=0)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
sig = dev[0].request("SIGNAL_POLL").splitlines()
if "WIDTH=40 MHz" not in sig:
@ -1243,16 +1086,7 @@ def _test_wpas_mesh_open_vht20(dev, apdev):
break
add_open_mesh_network(dev[i], freq="5180", chwidth=0, disable_ht40=True)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
sig = dev[0].request("SIGNAL_POLL").splitlines()
if "WIDTH=20 MHz" not in sig:
@ -1296,16 +1130,7 @@ def _test_wpas_mesh_open_vht_80p80(dev, apdev):
break
add_open_mesh_network(dev[i], freq="5180", chwidth=3)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
sig = dev[0].request("SIGNAL_POLL").splitlines()
if "WIDTH=80+80 MHz" not in sig:
@ -1364,19 +1189,10 @@ def _test_mesh_open_vht_160(dev, apdev):
add_open_mesh_network(dev[i], freq="5520", chwidth=2)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev, connectivity=True)
dev[0].dump_monitor()
dev[1].dump_monitor()
# Test connectivity 0->1 and 1->0
hwsim_utils.test_connectivity(dev[0], dev[1])
sig = dev[0].request("SIGNAL_POLL").splitlines()
if "WIDTH=160 MHz" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
@ -1413,10 +1229,7 @@ def test_wpas_mesh_password_mismatch(dev, apdev):
dev[2].mesh_group_add(id)
# The two peers with matching password need to be able to connect
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
ev = dev[2].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=20)
if ev is None:
@ -1472,9 +1285,7 @@ def test_wpas_mesh_password_mismatch_retry(dev, apdev, params):
dev[1].set_network_quoted(id, "psk", "wrong password")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
for i in range(4):
ev = dev[0].wait_event(["MESH-SAE-AUTH-FAILURE"], timeout=20)
@ -1544,10 +1355,7 @@ def _test_wpas_mesh_reconnect(dev):
dev[1].request("SET sae_groups ")
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
for i in range(3):
# Drop incoming management frames to avoid handling link close
@ -1622,13 +1430,7 @@ def test_wpas_mesh_pmksa_caching(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
addr0 = dev[0].own_addr()
addr1 = dev[1].own_addr()
@ -1664,9 +1466,7 @@ def test_wpas_mesh_pmksa_caching2(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
# Check for peer connected
ev = dev[0].wait_event(["will not initiate new peer link"], timeout=10)
@ -1674,8 +1474,7 @@ def test_wpas_mesh_pmksa_caching2(dev, apdev):
raise Exception("Missing no-initiate message")
if "OK" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD failed")
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
pmksa0 = dev[0].get_pmksa(addr1)
pmksa1 = dev[1].get_pmksa(addr0)
@ -1695,8 +1494,7 @@ def test_wpas_mesh_pmksa_caching2(dev, apdev):
raise Exception("Missing no-initiate message (2)")
if "OK" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD failed (2)")
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
pmksa0c = dev[0].get_pmksa(addr1)
pmksa1c = dev[1].get_pmksa(addr0)
@ -1724,9 +1522,7 @@ def test_wpas_mesh_pmksa_caching_no_match(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
# Check for peer connected
ev = dev[0].wait_event(["will not initiate new peer link"], timeout=10)
@ -1734,8 +1530,7 @@ def test_wpas_mesh_pmksa_caching_no_match(dev, apdev):
raise Exception("Missing no-initiate message")
if "OK" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD failed")
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
pmksa0 = dev[0].get_pmksa(addr1)
pmksa1 = dev[1].get_pmksa(addr0)
@ -1755,8 +1550,7 @@ def test_wpas_mesh_pmksa_caching_no_match(dev, apdev):
raise Exception("Missing no-initiate message (2)")
if "OK" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD failed (2)")
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
pmksa0c = dev[0].get_pmksa(addr1)
pmksa1c = dev[1].get_pmksa(addr0)
@ -1784,9 +1578,7 @@ def test_mesh_pmksa_caching_oom(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
# Check for peer connected
ev = dev[0].wait_event(["will not initiate new peer link"], timeout=10)
@ -1794,8 +1586,7 @@ def test_mesh_pmksa_caching_oom(dev, apdev):
raise Exception("Missing no-initiate message")
if "OK" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD failed")
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
if "OK" not in dev[0].request("MESH_PEER_REMOVE " + addr1):
raise Exception("Failed to remove peer")
@ -1823,13 +1614,7 @@ def test_wpas_mesh_pmksa_caching_ext(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
# Check for peer connected
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
dev[0].dump_monitor()
dev[1].dump_monitor()
@ -2012,8 +1797,7 @@ def test_mesh_sae_groups_invalid(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
ev = dev[0].wait_event(["new peer notification"], timeout=10)
if ev is None:
@ -2071,12 +1855,10 @@ def test_mesh_sae_failure(dev, apdev):
with alloc_fail(dev[1], count, func):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
if success:
# retry is expected to work
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
else:
wait_fail_trigger(dev[1], "GET_ALLOC_FAIL")
dev[0].mesh_group_remove()
@ -2095,12 +1877,10 @@ def test_mesh_failure(dev, apdev):
with alloc_fail(dev[1], count, func):
add_open_mesh_network(dev[1])
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
if success:
# retry is expected to work
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
else:
wait_fail_trigger(dev[1], "GET_ALLOC_FAIL")
dev[0].mesh_group_remove()
@ -2114,12 +1894,10 @@ def test_mesh_failure(dev, apdev):
with fail_test(dev[1], count, func):
add_open_mesh_network(dev[1])
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
if success:
# retry is expected to work
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
else:
wait_fail_trigger(dev[1], "GET_FAIL")
dev[0].mesh_group_remove()
@ -2182,9 +1960,7 @@ def test_mesh_missing_mic(dev, apdev):
id = add_mesh_secure_net(dev[1])
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
count = 0
remove_mic = True
@ -2232,9 +2008,7 @@ def test_mesh_pmkid_mismatch(dev, apdev):
dev[1].set_network(id, "no_auto_peer", "1")
dev[1].mesh_group_add(id)
# Check for mesh joined
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_joined2(dev)
# Check for peer connected
ev = dev[0].wait_event(["will not initiate new peer link"], timeout=10)
@ -2242,8 +2016,7 @@ def test_mesh_pmkid_mismatch(dev, apdev):
raise Exception("Missing no-initiate message")
if "OK" not in dev[0].request("MESH_PEER_ADD " + addr1):
raise Exception("MESH_PEER_ADD failed")
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_connected2(dev)
if "OK" not in dev[0].request("MESH_PEER_REMOVE " + addr1):
raise Exception("Failed to remove peer")
@ -2461,10 +2234,7 @@ def test_mesh_holding(dev, apdev):
check_mesh_support(dev[0])
add_open_mesh_network(dev[0])
add_open_mesh_network(dev[1])
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
check_mesh_joined_connected(dev)
addr0 = dev[0].own_addr()
addr1 = dev[1].own_addr()
@ -2590,11 +2360,7 @@ def test_mesh_select_network(dev):
id1 = add_open_mesh_network(dev[1], start=False)
dev[0].select_network(id0)
dev[1].select_network(id1)
check_mesh_group_added(dev[0])
check_mesh_group_added(dev[1])
check_mesh_peer_connected(dev[0])
check_mesh_peer_connected(dev[1])
hwsim_utils.test_connectivity(dev[0], dev[1])
check_mesh_joined_connected(dev, connectivity=True)
def test_mesh_forwarding(dev):
"""Mesh with two stations that can't reach each other directly"""