def verify(self, pv: PacketVerifier): pkts = pv.pkts pv.add_common_vars() pv.summary.show() with pkts.save_index(): pv.verify_attached('ROUTER') PBBR = pv.vars['PBBR'] ROUTER = pv.vars['ROUTER'] # PBBR MUST NOT send ICMPv6 Destination Unreachable pkts.filter_wpan_src64(PBBR).filter_wpan_dst64(ROUTER).filter( f'icmpv6.type == {ICMPV6_TYPE_DESTINATION_UNREACHABLE}' ).must_not_next()
def verify(self, pv: PacketVerifier): pkts = pv.pkts pv.add_common_vars() pv.summary.show() pv.verify_attached('BR_1') MM = pv.vars['MM_PORT'] BB = pv.vars['BB_PORT'] BR_1 = pv.vars['BR_1'] BR_1_ETH = pv.vars['BR_1_ETH'] Host_ETH = pv.vars['Host_ETH'] BR_1_BGUA = pv.vars['BR_1_BGUA'] Host_BGUA = pv.vars['Host_BGUA'] Dg = pv.vars['Dg'] # DUA of Router_2 ROUTER2 = pv.vars['Router_2'] # Step 3: BR_1: Checks received Network Data and determines that it needs to send its BBR Dataset to the # leader to become primary BBR. pkts.filter_wpan_src64(BR_1).filter_coap_request( '/a/sd', port=MM).must_next().must_verify(""" thread_nwd.tlv.server_16 is not null and thread_nwd.tlv.service.s_data.seqno is not null and thread_nwd.tlv.service.s_data.rrdelay is not null and thread_nwd.tlv.service.s_data.mlrtimeout is not null """) pv.verify_dua_registration(ROUTER2, Dg, pbbr_eth=BR_1_ETH, pbbr_src64=BR_1) # Verify Host ping BBR pkts.filter_eth_src(Host_ETH).filter_ipv6_src_dst( Host_BGUA, BR_1_BGUA).filter_ping_request().must_next() pkts.filter_eth_src(BR_1_ETH).filter_ipv6_src_dst( BR_1_BGUA, Host_BGUA).filter_ping_reply().must_next() # Verify BR_1 ping Host pkts.filter_eth_src(BR_1_ETH).filter_ipv6_src_dst( BR_1_BGUA, Host_BGUA).filter_ping_request().must_next() pkts.filter_eth_src(Host_ETH).filter_ipv6_src_dst( Host_BGUA, BR_1_BGUA).filter_ping_reply().must_next() # Step 16: Host: Queries DUA, Dg, with ND-NS pkts.filter_eth_src(Host_ETH).filter_icmpv6_nd_ns(Dg).must_next() # Step 17: BR_1: Responds with a neighbor advertisement. pkts.filter_eth_src(BR_1_ETH).filter_icmpv6_nd_na(Dg).must_next()
def verify(self, pv: PacketVerifier): pkts = pv.pkts pv.add_common_vars() pv.summary.show() pv.verify_attached('ROUTER1') ROUTER1 = pv.vars['ROUTER1'] COMMISSIONER = pv.vars['COMMISSIONER'] PBBR_ETH = pv.vars['PBBR_ETH'] SBBR_ETH = pv.vars['SBBR_ETH'] # Verify SBBR must not send `/b/bmr` during the test. pkts.filter_eth_src(SBBR_ETH).filter_coap_request('/b/bmr').must_not_next() # Verify PBBR sends `/b/bmr` on the Backbone link for MA1 with default timeout. pkts.filter_eth_src(PBBR_ETH).filter_coap_request('/b/bmr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA1}'] and thread_bl.tlv.timeout == {MLR_TIMEOUT} and ipv6.src.is_link_local """) # Router registers MA2 with default timeout pkts.filter_wpan_src64(ROUTER1).filter_coap_request('/n/mr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA2}'] and thread_bl.tlv.timeout is null """) # Verify PBBR sends `/b/bmr` on the Backbone link for MA2 with default timeout. pkts.filter_eth_src(PBBR_ETH).filter_coap_request('/b/bmr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA2}'] and thread_bl.tlv.timeout == {MLR_TIMEOUT} and ipv6.src.is_link_local """) # Commissioner registers MA3 with deafult timeout pkts.filter_wpan_src64(COMMISSIONER).filter_coap_request('/n/mr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA3}'] and thread_bl.tlv.timeout is null """) # Verify PBBR sends `/b/bmr` on the Backbone link for MA3 with default timeout. pkts.filter_eth_src(PBBR_ETH).filter_coap_request('/b/bmr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA3}'] and thread_bl.tlv.timeout == {MLR_TIMEOUT} and ipv6.src.is_link_local """) # Commissioner registers MA4 with custom timeout pkts.filter_wpan_src64(COMMISSIONER).filter_coap_request('/n/mr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA4}'] and thread_nm.tlv.timeout == {CUSTOM_MLR_TIMEOUT} """) # Verify PBBR sends `/b/bmr` on the Backbone link for MA4 with custom timeout. pkts.filter_eth_src(PBBR_ETH).filter_coap_request('/b/bmr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA4}'] and thread_bl.tlv.timeout == {CUSTOM_MLR_TIMEOUT} and ipv6.src.is_link_local """) # Commissioner unregisters MA5 pkts.filter_wpan_src64(COMMISSIONER).filter_coap_request('/n/mr').must_next().must_verify(f""" thread_meshcop.tlv.ipv6_addr == ['{MA5}'] and thread_nm.tlv.timeout == 0 """) # Verify PBBR not sends `/b/bmr` on the Backbone link for MA5. pkts.filter_eth_src(PBBR_ETH).filter_coap_request('/b/bmr').filter(f""" thread_meshcop.tlv.ipv6_addr == ['{MA5}'] and ipv6.src.is_link_local """).must_not_next()
def verify(self, pv: PacketVerifier): pkts = pv.pkts pv.summary.show() LEADER = pv.vars['LEADER'] LEADER_RLOC = pv.vars['LEADER_RLOC'] ROUTER_31 = pv.vars['ROUTER_31'] ROUTER_32 = pv.vars['ROUTER_32'] # Step 1: Topology is created, the DUT is the Leader of the network # and there is a total of 32 active routers, including the Leader. for i in range(1, 32): pv.verify_attached('ROUTER_%d' % i) # Step 2: Router_31 to attaches to the network and sends an Address # Solicit Request to become an active router. _pkt = pkts.filter_wpan_src64(ROUTER_31).\ filter_ipv6_dst(LEADER_RLOC).\ filter_coap_request(ADDR_SOL_URI).\ filter(lambda p: { NL_MAC_EXTENDED_ADDRESS_TLV, NL_STATUS_TLV } == set(p.coap.tlv.type) ).\ must_next() # Step 3: Leader sends an Address Solicit Response. # Ensure the Address Solicit Response is properly formatted: # CoAP Response Code # 2.04 Changed # CoAP Payload # - Status TLV (value = Success) # - RLOC16 TLV # - Router Mask TLV pkts.filter_wpan_src64(LEADER).\ filter_ipv6_dst(_pkt.ipv6.src).\ filter_coap_ack(ADDR_SOL_URI).\ filter(lambda p: { NL_STATUS_TLV, NL_RLOC16_TLV, NL_ROUTER_MASK_TLV } == set(p.coap.tlv.type) and\ p.coap.code == COAP_CODE_ACK and\ p.thread_address.tlv.status == ADDR_SOL_SUCCESS\ ).\ must_next() # Step 4: Leader The DUT sends MLE Advertisements. # The MLE Advertisements from the Leader MUST contain # the Route64 TLV with 32 assigned Router IDs. pkts.filter_wpan_src64(LEADER).\ filter_LLANMA().\ filter_mle_cmd(MLE_ADVERTISEMENT).\ filter(lambda p: { LEADER_DATA_TLV, ROUTE64_TLV, SOURCE_ADDRESS_TLV } == set(p.mle.tlv.type) and\ len(p.mle.tlv.route64.cost) == 32 and\ p.ipv6.hlim == 255 ).\ must_next() # Step 5: Router_32 to attach to any of the active routers, 2-hops # from the leader, and to send an Address Solicit Request # to become an active router. _pkt = pkts.filter_wpan_src64(ROUTER_32).\ filter_ipv6_dst(LEADER_RLOC).\ filter_coap_request(ADDR_SOL_URI).\ filter(lambda p: { NL_MAC_EXTENDED_ADDRESS_TLV, NL_STATUS_TLV } == set(p.coap.tlv.type) ).\ must_next() # Step 6: Leader sends an Address Solicit Response. # Ensure the Address Solicit Response is properly formatted: # CoAP Response Code # 2.04 Changed # CoAP Payload # - Status TLV (value = No Address Available) pkts.filter_wpan_src64(LEADER).\ filter_ipv6_dst(_pkt.ipv6.src).\ filter_coap_ack(ADDR_SOL_URI).\ filter(lambda p: p.coap.code == COAP_CODE_ACK and\ p.thread_address.tlv.status == ADDR_SOL_NA ).\ must_next()