diff --git a/tests/nexus/test_9_2_5.cpp b/tests/nexus/test_9_2_5.cpp index 07c2bd3bb..e9e8c6b2c 100644 --- a/tests/nexus/test_9_2_5.cpp +++ b/tests/nexus/test_9_2_5.cpp @@ -55,28 +55,35 @@ static constexpr uint32_t kResponseTime = 2000; */ static constexpr uint32_t kEchoTimeout = 5000; -static constexpr uint64_t kActiveTimestampStep2 = 20; -static constexpr uint32_t kChannelMaskStep2 = 0x07fff800; -static constexpr uint8_t kExtendedPanIdStep2[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77}; -static constexpr char kNetworkNameStep2[] = "nexus-test"; -static constexpr uint8_t kPskcStep2[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; +static constexpr uint64_t kActiveTimestampStep2 = 100; +static constexpr uint32_t kChannelMaskStep2 = 0x03fff800; +static constexpr uint8_t kExtendedPanIdStep2[] = {0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x01}; +static constexpr char kNetworkNameStep2[] = "TEST_1"; +static constexpr uint8_t kPskcStep2[] = {0xd2, 0xaa, 0x9c, 0xd8, 0xdf, 0xf7, 0x91, 0x91, + 0x22, 0xd7, 0x7d, 0x37, 0xec, 0x3c, 0x1b, 0x5f}; static constexpr uint16_t kRotationTimeStep2 = 3600; -static constexpr uint8_t kSecurityFlagsStep2[] = {0xfb}; +static constexpr uint8_t kSecurityFlagsStep2[] = {0xef}; -static constexpr uint64_t kActiveTimestampStep7 = 10; +static constexpr uint64_t kActiveTimestampStep7 = 99; +static constexpr uint32_t kChannelMaskStep7 = 0x01fff800; +static constexpr uint8_t kExtendedPanIdStep7[] = {0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x02}; +static constexpr char kNetworkNameStep7[] = "TEST_2"; +static constexpr uint8_t kPskcStep7[] = {0x17, 0xd6, 0x72, 0xbe, 0x32, 0xb0, 0xc2, 0x4a, + 0x2f, 0x83, 0x85, 0xf2, 0xfb, 0xaf, 0x1d, 0x97}; +static constexpr uint8_t kSecurityFlagsStep7[] = {0xff}; -static constexpr uint64_t kActiveTimestampStep9 = 30; -static constexpr uint32_t kChannelMaskStep9 = 0x001fffe0; -static constexpr uint8_t kExtendedPanIdStep9[] = {0x01, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77}; -static constexpr char kNetworkNameStep9[] = "nexus-925"; -static constexpr uint8_t kPskcStep9[] = {0x11, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; +static constexpr uint64_t kActiveTimestampStep9 = 101; +static constexpr uint32_t kChannelMaskStep9 = 0x00fff800; +static constexpr uint8_t kExtendedPanIdStep9[] = {0x00, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x03}; +static constexpr char kNetworkNameStep9[] = "TEST_3"; +static constexpr uint8_t kPskcStep9[] = {0x08, 0xf4, 0xe9, 0x53, 0x1e, 0x8e, 0xfa, 0x8e, + 0x85, 0x2d, 0x5f, 0x4f, 0xb9, 0x51, 0xb1, 0x3e}; static constexpr uint16_t kRotationTimeStep9 = 7200; -static constexpr uint8_t kSecurityFlagsStep9[] = {0x7b}; +static constexpr uint8_t kSecurityFlagsStep9[] = {0xff}; static constexpr uint8_t kFutureTlv[] = {130, 2, 0xaa, 0x55}; -static constexpr uint64_t kActiveTimestampStep14 = 40; +static constexpr uint64_t kActiveTimestampStep14 = 102; +static constexpr uint8_t kSecurityFlagsStep14[] = {0xf8}; static constexpr uint16_t kUnsupportedChannel = 63; void Test9_2_5(void) @@ -205,7 +212,8 @@ void Test9_2_5(void) /** * Step 5: Router_1 - * - Description: Automatically sends a unicast MLE Data Request to Leader, including the following TLVs: + * - Description: Automatically sends a unicast MLE Data Request to Router_1 (Note: this appears to be a typo in the + * specification, as Router_1 would likely send it to the Leader), including the following TLVs: * - TLV Request TLV: * - Network Data TLV * - Active Timestamp TLV @@ -264,6 +272,12 @@ void Test9_2_5(void) timestamp.SetSeconds(kActiveTimestampStep7); datasetInfo.Set(timestamp); + datasetInfo.Set(kChannelMaskStep7); + datasetInfo.Set( + AsCoreType(reinterpret_cast(kExtendedPanIdStep7))); + SuccessOrQuit(datasetInfo.Update().Set(kNetworkNameStep7)); + datasetInfo.Set(AsCoreType(reinterpret_cast(kPskcStep7))); + datasetInfo.Update().SetFlags(kSecurityFlagsStep7, sizeof(kSecurityFlagsStep7)); SuccessOrQuit( router1.Get().SendSetRequest(datasetInfo, nullptr, 0, nullptr, nullptr)); @@ -418,6 +432,8 @@ void Test9_2_5(void) timestamp.SetSeconds(kActiveTimestampStep14); datasetInfo.Set(timestamp); datasetInfo.Set(kUnsupportedChannel); + datasetInfo.Update().SetFlags(kSecurityFlagsStep14, + sizeof(kSecurityFlagsStep14)); SuccessOrQuit( router1.Get().SendSetRequest(datasetInfo, nullptr, 0, nullptr, nullptr)); diff --git a/tests/nexus/verify_9_2_5.py b/tests/nexus/verify_9_2_5.py index c41d65dd5..8ff06b118 100644 --- a/tests/nexus/verify_9_2_5.py +++ b/tests/nexus/verify_9_2_5.py @@ -39,10 +39,10 @@ from pktverify import consts def verify(pv): - # 9.2.5 Updating the Active Operational Dataset via Thread node + # 9.2.5 Updating the Active Operational Dataset via Thread Node # # 9.2.5.1 Topology - # DUT as Leader, Router_1 + # * DUT as Leader, Router_1 # # 9.2.5.2 Purpose & Description # The purpose of this test case is to verify the DUT’s behavior when receiving MGMT_ACTIVE_SET.req from an active @@ -61,7 +61,7 @@ def verify(pv): # Step 1: All # - Description: Ensure topology is formed correctly. # - Pass Criteria: N/A. - print("Step 1: Ensure topology is formed correctly.") + print("Step 1: All") # Step 2: Router_1 # - Description: Harness instructs Router_1 to send a MGMT_ACTIVE_SET.req to the Leader (DUT)’s Routing or Anycast @@ -82,7 +82,7 @@ def verify(pv): # - PAN ID (old value) # - Channel (old value) # - The DUT’s Anycast Locator uses the Mesh local prefix with an IID of 0000:00FF:FE00:FC00. - print("Step 2: Router_1 sends MGMT_ACTIVE_SET.req with new valid Active Timestamp.") + print("Step 2: Router_1") pkts.filter_wpan_src64(ROUTER_1).\ filter_coap_request(consts.MGMT_ACTIVE_SET_URI).\ filter(lambda p: { @@ -97,8 +97,8 @@ def verify(pv): consts.NM_PAN_ID_TLV, consts.NM_CHANNEL_TLV } <= set(p.coap.tlv.type)).\ - filter(lambda p: p.coap.tlv.active_timestamp == 20 and\ - p.coap.tlv.network_name == 'nexus-test').\ + filter(lambda p: p.coap.tlv.active_timestamp == 100 and\ + p.coap.tlv.network_name == 'TEST_1').\ filter(lambda p: p.ipv6.dst.endswith(bytes.fromhex("000000fffe00fc00"))).\ must_next() @@ -107,7 +107,7 @@ def verify(pv): # - Pass Criteria: The DUT MUST send MGMT_ACTIVE_SET.rsp to Router_1 with the following format: # - CoAP Response Code: 2.04 Changed # - CoAP Payload: State TLV (value = Accept (01)) - print("Step 3: Leader sends MGMT_ACTIVE_SET.rsp with State TLV = Accept.") + print("Step 3: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_coap_ack(consts.MGMT_ACTIVE_SET_URI).\ filter(lambda p: p.coap.tlv.state == 1).\ @@ -122,7 +122,7 @@ def verify(pv): # - Stable Version field [incremented] # - Network Data TLV # - Active Timestamp TLV [new value set in Step 2] - print("Step 4: Leader sends a Multicast MLE Data Response.") + print("Step 4: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_LLANMA().\ filter_mle_cmd(consts.MLE_DATA_RESPONSE).\ @@ -132,16 +132,17 @@ def verify(pv): consts.NETWORK_DATA_TLV, consts.ACTIVE_TIMESTAMP_TLV } <= set(p.mle.tlv.type)).\ - filter(lambda p: p.mle.tlv.active_tstamp == 20).\ + filter(lambda p: p.mle.tlv.active_tstamp == 100).\ must_next() # Step 5: Router_1 - # - Description: Automatically sends a unicast MLE Data Request to Leader, including the following TLVs: + # - Description: Automatically sends a unicast MLE Data Request to Router_1 (Note: this appears to be a typo in the + # specification, as Router_1 would likely send it to the Leader), including the following TLVs: # - TLV Request TLV: # - Network Data TLV # - Active Timestamp TLV # - Pass Criteria: N/A. - print("Step 5: Router_1 sends a unicast MLE Data Request to Leader.") + print("Step 5: Router_1") pkts.filter_wpan_src64(ROUTER_1).\ filter_wpan_dst64(LEADER).\ filter_mle_cmd(consts.MLE_DATA_REQUEST).\ @@ -168,7 +169,7 @@ def verify(pv): # - PSKc TLV [new value set in Step 2] # - Security Policy TLV [new value set in Step 2] # - Active Timestamp TLV [new value set in Step 2] - print("Step 6: Leader sends a unicast MLE Data Response to Router_1.") + print("Step 6: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_wpan_dst64(ROUTER_1).\ filter_mle_cmd(consts.MLE_DATA_RESPONSE).\ @@ -179,7 +180,7 @@ def verify(pv): consts.ACTIVE_OPERATION_DATASET_TLV, consts.ACTIVE_TIMESTAMP_TLV } <= set(p.mle.tlv.type)).\ - filter(lambda p: p.mle.tlv.active_tstamp == 20).\ + filter(lambda p: p.mle.tlv.active_tstamp == 100).\ must_next() # Step 7: Router_1 @@ -201,10 +202,23 @@ def verify(pv): # - PAN ID (old value) # - Channel (old value) # - The DUT’s Anycast Locator uses the Mesh local prefix with an IID of 0000:00FF:FE00:FC00. - print("Step 7: Router_1 sends MGMT_ACTIVE_SET.req with old invalid Active Timestamp.") + print("Step 7: Router_1") pkts.filter_wpan_src64(ROUTER_1).\ filter_coap_request(consts.MGMT_ACTIVE_SET_URI).\ - filter(lambda p: p.coap.tlv.active_timestamp == 10).\ + filter(lambda p: { + consts.NM_ACTIVE_TIMESTAMP_TLV, + consts.NM_CHANNEL_MASK_TLV, + consts.NM_EXTENDED_PAN_ID_TLV, + consts.NM_NETWORK_MESH_LOCAL_PREFIX_TLV, + consts.NM_NETWORK_NAME_TLV, + consts.NM_PSKC_TLV, + consts.NM_SECURITY_POLICY_TLV, + consts.NM_NETWORK_KEY_TLV, + consts.NM_PAN_ID_TLV, + consts.NM_CHANNEL_TLV + } <= set(p.coap.tlv.type)).\ + filter(lambda p: p.coap.tlv.active_timestamp == 99 and\ + p.coap.tlv.network_name == 'TEST_2').\ filter(lambda p: p.ipv6.dst.endswith(bytes.fromhex("000000fffe00fc00"))).\ must_next() @@ -213,7 +227,7 @@ def verify(pv): # - Pass Criteria: The DUT MUST send MGMT_ACTIVE_SET.rsp to Router_1, with the following format: # - CoAP Response Code: 2.04 Changed # - CoAP Payload: State TLV (value = Reject (ff)) - print("Step 8: Leader sends MGMT_ACTIVE_SET.rsp with State TLV = Reject.") + print("Step 8: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_coap_ack(consts.MGMT_ACTIVE_SET_URI).\ filter(lambda p: p.coap.tlv.state == 255).\ @@ -243,19 +257,23 @@ def verify(pv): # - Length 2 # - Value (aa 55) # - The DUT’s Anycast Locator uses the Mesh local prefix with an IID of 0000:00FF:FE00:FC00. - print("Step 9: Router_1 sends MGMT_ACTIVE_SET.req with new valid Active Timestamp and Future TLV.") + print("Step 9: Router_1") pkts.filter_wpan_src64(ROUTER_1).\ filter_coap_request(consts.MGMT_ACTIVE_SET_URI).\ filter(lambda p: { consts.NM_ACTIVE_TIMESTAMP_TLV, consts.NM_CHANNEL_MASK_TLV, consts.NM_EXTENDED_PAN_ID_TLV, + consts.NM_NETWORK_MESH_LOCAL_PREFIX_TLV, consts.NM_NETWORK_NAME_TLV, consts.NM_PSKC_TLV, - consts.NM_SECURITY_POLICY_TLV + consts.NM_SECURITY_POLICY_TLV, + consts.NM_NETWORK_KEY_TLV, + consts.NM_PAN_ID_TLV, + consts.NM_CHANNEL_TLV } <= set(p.coap.tlv.type)).\ - filter(lambda p: p.coap.tlv.active_timestamp == 30 and\ - p.coap.tlv.network_name == 'nexus-925').\ + filter(lambda p: p.coap.tlv.active_timestamp == 101 and\ + p.coap.tlv.network_name == 'TEST_3').\ filter(lambda p: 130 in p.coap.tlv.type).\ filter(lambda p: p.ipv6.dst.endswith(bytes.fromhex("000000fffe00fc00"))).\ must_next() @@ -265,7 +283,7 @@ def verify(pv): # - Pass Criteria: The DUT MUST send MGMT_ACTIVE_SET.rsp to Router_1 with the following format: # - CoAP Response Code: 2.04 Changed # - CoAP Payload: State TLV (value = Accept (01)) - print("Step 10: Leader sends MGMT_ACTIVE_SET.rsp with State TLV = Accept.") + print("Step 10: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_coap_ack(consts.MGMT_ACTIVE_SET_URI).\ filter(lambda p: p.coap.tlv.state == 1).\ @@ -280,11 +298,11 @@ def verify(pv): # - Stable Version field [incremented] # - Network Data TLV # - Active Timestamp TLV [new value set in Step 9] - print("Step 11: Leader sends a Multicast MLE Data Response.") + print("Step 11: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_LLANMA().\ filter_mle_cmd(consts.MLE_DATA_RESPONSE).\ - filter(lambda p: p.mle.tlv.active_tstamp == 30).\ + filter(lambda p: p.mle.tlv.active_tstamp == 101).\ must_next() # Step 12: Router_1 @@ -293,7 +311,7 @@ def verify(pv): # - Network Data TLV # - Active Timestamp TLV # - Pass Criteria: N/A. - print("Step 12: Router_1 sends a unicast MLE Data Request to Leader.") + print("Step 12: Router_1") pkts.filter_wpan_src64(ROUTER_1).\ filter_wpan_dst64(LEADER).\ filter_mle_cmd(consts.MLE_DATA_REQUEST).\ @@ -321,7 +339,7 @@ def verify(pv): # - PSKc TLV [new value set in Step 9] # - Security Policy TLV [new value set in Step 9] # - Active Timestamp TLV [new value set in Step 9] - print("Step 13: Leader sends a unicast MLE Data Response to Router_1.") + print("Step 13: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_wpan_dst64(ROUTER_1).\ filter_mle_cmd(consts.MLE_DATA_RESPONSE).\ @@ -332,7 +350,7 @@ def verify(pv): consts.ACTIVE_OPERATION_DATASET_TLV, consts.ACTIVE_TIMESTAMP_TLV } <= set(p.mle.tlv.type)).\ - filter(lambda p: p.mle.tlv.active_tstamp == 30).\ + filter(lambda p: p.mle.tlv.active_tstamp == 101).\ must_next() # Step 14: Router_1 @@ -354,10 +372,22 @@ def verify(pv): # - Network Master Key (old value) # - PAN ID (old value) # - The DUT Anycast Locator uses the Mesh local prefix with an IID of 0000:00FF:FE00:FC00. - print("Step 14: Router_1 sends MGMT_ACTIVE_SET.req with unsupported Channel.") + print("Step 14: Router_1") pkts.filter_wpan_src64(ROUTER_1).\ filter_coap_request(consts.MGMT_ACTIVE_SET_URI).\ - filter(lambda p: p.coap.tlv.active_timestamp == 40 and\ + filter(lambda p: { + consts.NM_ACTIVE_TIMESTAMP_TLV, + consts.NM_CHANNEL_TLV, + consts.NM_CHANNEL_MASK_TLV, + consts.NM_EXTENDED_PAN_ID_TLV, + consts.NM_NETWORK_MESH_LOCAL_PREFIX_TLV, + consts.NM_NETWORK_NAME_TLV, + consts.NM_PSKC_TLV, + consts.NM_SECURITY_POLICY_TLV, + consts.NM_NETWORK_KEY_TLV, + consts.NM_PAN_ID_TLV + } <= set(p.coap.tlv.type)).\ + filter(lambda p: p.coap.tlv.active_timestamp == 102 and\ p.coap.tlv.channel == 63).\ filter(lambda p: p.ipv6.dst.endswith(bytes.fromhex("000000fffe00fc00"))).\ must_next() @@ -367,7 +397,7 @@ def verify(pv): # - Pass Criteria: The DUT MUST send MGMT_ACTIVE_SET.rsp to Router_1 with the following format: # - CoAP Response Code: 2.04 Changed # - CoAP Payload: State TLV (value = Reject (ff)) - print("Step 15: Leader sends MGMT_ACTIVE_SET.rsp with State TLV = Reject.") + print("Step 15: Leader (DUT)") pkts.filter_wpan_src64(LEADER).\ filter_coap_ack(consts.MGMT_ACTIVE_SET_URI).\ filter(lambda p: p.coap.tlv.state == 255).\ @@ -376,7 +406,7 @@ def verify(pv): # Step 16: All # - Description: Verify connectivity by sending an ICMPv6 Echo Request to the DUT mesh local address. # - Pass Criteria: The DUT must respond with an ICMPv6 Echo Reply. - print("Step 16: Verify connectivity by sending an ICMPv6 Echo Request.") + print("Step 16: All") # Match any ping request and reply. _pkt = pkts.filter_ping_request().\ must_next()