def check_r1_again_prefers_trel_for_r2(): r1_neighbor_radios = wpan.parse_multi_radio_result( r1.get(wpan.WPAN_OT_NEIGHBOR_TABLE_MULTI_RADIO_INFO)) verify(len(r1_neighbor_radios) == 1) r2_radio_info = r1_neighbor_radios[0] verify(r2_radio_info.supports(wpan.RADIO_LINK_TREL_UDP6)) verify( r2_radio_info.preference(wpan.RADIO_LINK_TREL_UDP6) >= HIGH_PREFERENCE_THRESHOLD)
verify(len(r1_neighbor_radios) == 1) verify(len(r1_neighbor_radios[0].radios) == 2) wpan.verify_within(check_r1_sees_r2_has_two_radio_links, WAIT_TIME) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Send from r1 to r2 and verify that r1 prefers TREL radio link for sending to r2. sender = r1.prepare_tx(r1_ml_address, r2_ml_address, "Hi r2 from r1", 5) recver = r2.prepare_rx(sender) wpan.Node.perform_async_tx_rx() verify(sender.was_successful) verify(recver.was_successful) r1_neighbor_radios = wpan.parse_multi_radio_result( r1.get(wpan.WPAN_OT_NEIGHBOR_TABLE_MULTI_RADIO_INFO)) verify(len(r1_neighbor_radios) == 1) r2_radio_info = r1_neighbor_radios[0] verify(r2_radio_info.supports(wpan.RADIO_LINK_TREL_UDP6)) verify( r2_radio_info.preference(wpan.RADIO_LINK_TREL_UDP6) >= HIGH_PREFERENCE_THRESHOLD) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Now disable TREL link on r2 and send again. We expect that r1 would quickly learn that trel is # no longer supported by r2 and prefer 15.4 for tx to r2. r2.set(wpan.WPAN_OT_TREL_TEST_MODE_ENABLE, 'false') verify(r2.get(wpan.WPAN_OT_TREL_TEST_MODE_ENABLE) == 'false') sender = r1.prepare_tx(r1_ml_address, r2_ml_address, "Hi again r2 from r1", 5)
def check_r1_sees_r2_has_two_radio_links(): r1_neighbor_radios = wpan.parse_multi_radio_result( r1.get(wpan.WPAN_OT_NEIGHBOR_TABLE_MULTI_RADIO_INFO)) verify(len(r1_neighbor_radios) == 1) verify(len(r1_neighbor_radios[0].radios) == 2)
verify(len(c2_radios) == 1 and wpan.RADIO_LINK_TREL_UDP6 in c2_radios) c3_radios = wpan.parse_list(c3.get(wpan.WPAN_OT_SUPPORTED_RADIO_LINKS)) verify( len(c3_radios) == 2 and (wpan.RADIO_LINK_IEEE_802_15_4 in c3_radios) and (wpan.RADIO_LINK_TREL_UDP6 in c3_radios)) parent.form("multi-radio") c1.join_node(parent, wpan.JOIN_TYPE_END_DEVICE) c2.join_node(parent, wpan.JOIN_TYPE_END_DEVICE) c3.join_node(parent, wpan.JOIN_TYPE_END_DEVICE) # Verify that parent correctly knows about all the children and their supported radio links radio_info_entries = wpan.parse_multi_radio_result( parent.get(wpan.WPAN_OT_NEIGHBOR_TABLE_MULTI_RADIO_INFO)) verify(len(radio_info_entries) == 3) for node in [c1, c2, c3]: # Find the entry matching node ext address address = node.get(wpan.WPAN_EXT_ADDRESS)[1:-1] filtred_list = [ entry for entry in radio_info_entries if entry.ext_address == address ] verify(len(filtred_list) == 1) entry = filtred_list[0] # Verify that the multi radio info matches the radio links supported by the node node_radios = wpan.parse_list(node.get(wpan.WPAN_OT_SUPPORTED_RADIO_LINKS)) verify(len(node_radios) == len(entry.radios)) for radio in node_radios: