def check_r1_router_table(): router_table = wpan.parse_router_table_result( r1.get(wpan.WPAN_THREAD_ROUTER_TABLE)) verify(len(router_table) == 3) for entry in router_table: verify(entry.rloc16 == r1_rloc or entry.is_link_established() or entry.next_hop != INVALID_ROUTER_ID)
def check_r4_router_table(): router_table = wpan.parse_router_table_result(r4.get(wpan.WPAN_THREAD_ROUTER_TABLE)) verify(len(router_table) == 4) for entry in router_table: if entry.rloc16 == r1_rloc: # r4's next hop towards r1 should be through r3. verify(not entry.is_link_established()) verify(entry.next_hop == r3_id) elif entry.rloc16 == r2_rloc: # r4's next hop towards r2 should be through r3. verify(not entry.is_link_established()); verify(entry.next_hop == r3_id) elif entry.rloc16 == r3_rloc: # r4 should be directly connected to r3. verify(entry.is_link_established()) verify(entry.ext_address == r3_ext_addr) elif entry.rloc16 == r4_rloc: pass else: raise(wpan.VerifyError("unknown entry in the router table of r4"))
def check_r3_router_table(): router_table = wpan.parse_router_table_result(r3.get(wpan.WPAN_THREAD_ROUTER_TABLE)) verify(len(router_table) == 4) for entry in router_table: if entry.rloc16 == r1_rloc: # r3 should be directly connected to r1. verify(entry.is_link_established()) verify(entry.ext_address == r1_ext_addr) elif entry.rloc16 == r2_rloc: # r3 should be directly connected to r2. verify(entry.is_link_established()) verify(entry.ext_address == r2_ext_addr) elif entry.rloc16 == r3_rloc: pass elif entry.rloc16 == r4_rloc: # r3 should be directly connected to r4. verify(entry.is_link_established()); verify(entry.ext_address == r4_ext_addr) else: raise(wpan.VerifyError("unknown entry in the router table of r3"))
def check_r4_router_table(): router_table = wpan.parse_router_table_result( r4.get(wpan.WPAN_THREAD_ROUTER_TABLE)) verify(len(router_table) == 4) for entry in router_table: if entry.rloc16 == r1_rloc: # r4's next hop towards r1 should be through r3. verify(not entry.is_link_established()) verify(entry.next_hop == r3_id) elif entry.rloc16 == r2_rloc: # r4's next hop towards r2 should be through r3. verify(not entry.is_link_established()) verify(entry.next_hop == r3_id) elif entry.rloc16 == r3_rloc: # r4 should be directly connected to r3. verify(entry.is_link_established()) verify(entry.ext_address == r3_ext_addr) elif entry.rloc16 == r4_rloc: pass else: raise (wpan.VerifyError("unknown entry in the router table of r4"))
def check_r3_router_table(): router_table = wpan.parse_router_table_result( r3.get(wpan.WPAN_THREAD_ROUTER_TABLE)) verify(len(router_table) == 4) for entry in router_table: if entry.rloc16 == r1_rloc: # r3 should be directly connected to r1. verify(entry.is_link_established()) verify(entry.ext_address == r1_ext_addr) elif entry.rloc16 == r2_rloc: # r3 should be directly connected to r2. verify(entry.is_link_established()) verify(entry.ext_address == r2_ext_addr) elif entry.rloc16 == r3_rloc: pass elif entry.rloc16 == r4_rloc: # r3 should be directly connected to r4. verify(entry.is_link_established()) verify(entry.ext_address == r4_ext_addr) else: raise (wpan.VerifyError("unknown entry in the router table of r3"))
def check_r1_router_table(): router_table = wpan.parse_router_table_result(r1.get(wpan.WPAN_THREAD_ROUTER_TABLE)) verify(len(router_table) == 3) for entry in router_table: if entry.rloc16 == r3_rloc: verify(entry.next_hop != INVALID_ROUTER_ID)