From 858ad199c0da59da5522f9d4049a3f3250983981 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Wed, 4 Mar 2026 19:29:11 -0600 Subject: [PATCH] [nexus] add test 1.2.LP.5.3.5 for minimum SSED support (#12607) This commit adds Nexus test 1.2.LP.5.3.5 to verify that a Router (DUT) can reliably support a minimum of 6 Synchronized Sleepy End Device (SSED) children simultaneously, with each child operating on a distinct CSL channel. The test implementation in test_1_2_LP_5_3_5.cpp (aligned with SPEC Section 3.2.6.3.2) performs the following: - Establishes a topology with a Leader, the DUT Router, and six SSED children. - Configures SSEDs with varied CSL Synchronized Timeouts (10s, 20s, and 30s) and different radio channels, including primary (11), secondary (26), and random channels (12-15). - Triggers CSL synchronization through MLE Child ID and Child Update exchanges. - Validates bi-directional connectivity by sending ICMPv6 Echo Requests from the Leader to each SSED, ensuring they are correctly forwarded by the DUT. The verification script verify_1_2_LP_5_3_5.py automates packet-level checks, ensuring: - Successful delivery of MLE Child ID and Child Update Response messages from the DUT. - Correct radio channel selection for forwarded Echo Requests to SSED_1 and SSED_6. - Absence of MAC Data Requests from SSED_1 prior to the arrival of the CSL-probed Echo Request, confirming active synchronization. - Inclusion of CSL Period and Phase IEs in the 802.15.4 frame headers of Echo Replies from SSED_1 and SSED_6. - Reliable forwarding of Echo Replies from all six SSEDs back to the Leader. Changes also include registering the new test in CMakeLists.txt and run_nexus_tests.sh. --- tests/nexus/CMakeLists.txt | 1 + tests/nexus/run_nexus_tests.sh | 1 + tests/nexus/test_1_2_LP_5_3_5.cpp | 346 +++++++++++++++++++++++++++++ tests/nexus/verify_1_2_LP_5_3_5.py | 277 +++++++++++++++++++++++ 4 files changed, 625 insertions(+) create mode 100644 tests/nexus/test_1_2_LP_5_3_5.cpp create mode 100644 tests/nexus/verify_1_2_LP_5_3_5.py diff --git a/tests/nexus/CMakeLists.txt b/tests/nexus/CMakeLists.txt index 7486d1cbd..cc93382db 100644 --- a/tests/nexus/CMakeLists.txt +++ b/tests/nexus/CMakeLists.txt @@ -219,6 +219,7 @@ ot_nexus_test(1_2_LP_5_3_1 "cert;nexus") ot_nexus_test(1_2_LP_5_3_2 "cert;nexus") ot_nexus_test(1_2_LP_5_3_3 "cert;nexus") ot_nexus_test(1_2_LP_5_3_4 "cert;nexus") +ot_nexus_test(1_2_LP_5_3_5 "cert;nexus") # Misc tests ot_nexus_test(border_admitter "core;nexus") diff --git a/tests/nexus/run_nexus_tests.sh b/tests/nexus/run_nexus_tests.sh index eacbbe932..09a771f69 100755 --- a/tests/nexus/run_nexus_tests.sh +++ b/tests/nexus/run_nexus_tests.sh @@ -154,6 +154,7 @@ DEFAULT_TESTS=( "1_2_LP_5_3_2" "1_2_LP_5_3_3" "1_2_LP_5_3_4" + "1_2_LP_5_3_5" ) # Use provided arguments or the default test list diff --git a/tests/nexus/test_1_2_LP_5_3_5.cpp b/tests/nexus/test_1_2_LP_5_3_5.cpp new file mode 100644 index 000000000..868248b8c --- /dev/null +++ b/tests/nexus/test_1_2_LP_5_3_5.cpp @@ -0,0 +1,346 @@ +/* + * Copyright (c) 2026, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "platform/nexus_core.hpp" +#include "platform/nexus_node.hpp" + +namespace ot { +namespace Nexus { + +/** + * Time to advance for a node to form a network and become leader, in milliseconds. + */ +static constexpr uint32_t kFormNetworkTime = 13 * 1000; + +/** + * Time to advance for a node to join as a child and upgrade to a router, in milliseconds. + */ +static constexpr uint32_t kAttachToRouterTime = 200 * 1000; + +/** + * Time to advance for a node to join as a SSED. + */ +static constexpr uint32_t kAttachAsSsedTime = 20 * 1000; + +/** + * Time to advance for the network to stabilize after nodes have attached. + */ +static constexpr uint32_t kStabilizationTime = 10 * 1000; + +/** + * CSL synchronized timeout in seconds. + */ +static constexpr uint32_t kCslTimeout10s = 10; +static constexpr uint32_t kCslTimeout20s = 20; +static constexpr uint32_t kCslTimeout30s = 30; + +/** + * Wait times as specified in the test procedure. + */ +static constexpr uint32_t kWaitTime35s = 35 * 1000; + +/** + * Payload size for a standard ICMPv6 Echo Request. + */ +static constexpr uint16_t kEchoPayloadSize = 10; + +/** + * Radio channels. + */ +static constexpr uint8_t kPrimaryChannel = 11; +static constexpr uint8_t kSecondaryChannel = 26; +static constexpr uint8_t kRandomChannel2 = 12; +static constexpr uint8_t kRandomChannel3 = 13; +static constexpr uint8_t kRandomChannel4 = 14; +static constexpr uint8_t kRandomChannel5 = 15; + +/** + * Echo request identifiers. + */ +static constexpr uint16_t kEchoIdentifierStep3 = 0x1234; +static constexpr uint16_t kEchoIdentifierStep6 = 0x5678; + +void Test1_2_LP_5_3_5(void) +{ + /** + * 5.3.5 Minimum number of SSED Support + * + * 5.3.5.1 Topology + * - Leader + * - Router_1 (DUT) + * - SSED_1 + * - SSED_2 + * - SSED_3 + * - SSED_4 + * - SSED_5 + * - SSED_6 + * + * 5.3.5.2 Purpose and Description + * The purpose of this test is to verify that a Router can reliably support + * a minimum of 6 SSED children simultaneously that are each using a + * different CSL channel. + * + * - SSED_1 and SSED_2 are each configured with a CSL Synchronized + * Timeout of 10 seconds. + * - SSED_3 and SSED_4 are each configured with a CSL Synchronized + * Timeout of 20 seconds. + * - SSED_5 and SSED_6 are each configured with a CSL Synchronized + * Timeout of 30 seconds. + * + * SSED 1 and 6 are configured to use the Primary and Secondary harness + * channels, respectively. The other four SSEDs are configured to run + * on another four available random channels. No over-the-air + * captures are generated for these four SSEDs. + * + * SPEC Section: 3.2.6.3.2 + */ + + Core nexus; + + static constexpr uint8_t kNumSseds = 6; + + Node &leader = nexus.CreateNode(); + Node &router1 = nexus.CreateNode(); + Node *sseds[kNumSseds]; + + leader.SetName("LEADER"); + router1.SetName("DUT"); + + for (int i = 0; i < kNumSseds; i++) + { + sseds[i] = &nexus.CreateNode(); + sseds[i]->SetName("SSED", i + 1); + } + + nexus.AdvanceTime(0); + + Instance::SetLogLevel(kLogLevelNote); + + Log("Step 0: SSED_1-6"); + + /** + * Step 0: SSED_1-6 + * - Description: Preconditions: + * - Set CSL Period = 500ms + * - SSED_1, _2: Set CSL Synchronized Timeout = 10s + * - SSED_3, _4: Set CSL Synchronized Timeout = 20s + * - SSED_5, _6: Set CSL Synchronized Timeout = 30s + * - Pass Criteria: N/A + */ + + // Target parameters as specified in Step 0 + static constexpr uint32_t kCslTimeouts[] = {kCslTimeout10s, kCslTimeout10s, kCslTimeout20s, + kCslTimeout20s, kCslTimeout30s, kCslTimeout30s}; + static constexpr uint8_t kCslChannels[] = {kPrimaryChannel, kRandomChannel2, kRandomChannel3, + kRandomChannel4, kRandomChannel5, kSecondaryChannel}; + + Log("Step 1: All"); + + /** + * Step 1: All + * - Description: Topology formation: DUT, SSED_1, SSED_2, SSED_3, + * SSED_4, SSED_5, SSED_6. + * - Pass Criteria: N/A + */ + + leader.AllowList(router1); + router1.AllowList(leader); + + for (Node *ssed : sseds) + { + router1.AllowList(*ssed); + ssed->AllowList(router1); + } + + leader.Form(); + nexus.AdvanceTime(kFormNetworkTime); + VerifyOrQuit(leader.Get().IsLeader()); + + router1.Join(leader); + nexus.AdvanceTime(kAttachToRouterTime); + VerifyOrQuit(router1.Get().IsRouter()); + + // Join SSEDs. + // To satisfy criterion 2.2 (Child Update Response for SSED_1), SSED_1 joins with defaults first, + // and then we update its parameters after it attaches. + // Others join with their target parameters directly to establish sync during Child ID exchange. + + for (int i = 0; i < kNumSseds; i++) + { + if (i > 0) + { + // For SSED_2-6, apply target parameters before joining so they are used in Child ID Request + sseds[i]->Get().SetCslPeriod(kCslPeriod500ms); + sseds[i]->Get().SetCslTimeout(kCslTimeouts[i]); + sseds[i]->Get().SetCslChannel(kCslChannels[i]); + } + + sseds[i]->Join(router1, Node::kAsSed); + } + + Log("Step 2: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6"); + + /** + * Step 2: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 + * - Description: Each device automatically attaches to the DUT and + * establishes CSL synchronization. + * - Pass Criteria: + * - 2.1: The DUT MUST unicast MLE Child ID Response to SSED_1. + * - 2.2: The DUT MUST unicast MLE Child Update Response to SSED_1. + * - 2.3: The DUT MUST unicast MLE Child ID Response to SSED_2. + * - 2.4: The DUT MUST unicast MLE Child ID Response to SSED_3. + * - 2.5: The DUT MUST unicast MLE Child ID Response to SSED_4. + * - 2.6: The DUT MUST unicast MLE Child ID Response to SSED_5. + * - 2.7: The DUT MUST unicast MLE Child ID Response to SSED_6. + */ + + // Initial attach for all SSEDs + nexus.AdvanceTime(kAttachAsSsedTime); + + for (Node *ssed : sseds) + { + VerifyOrQuit(ssed->Get().IsAttached()); + } + + // Now update SSED_1 to trigger MLE Child Update Request/Response (Criterion 2.2) + sseds[0]->Get().SetCslPeriod(kCslPeriod500ms); + sseds[0]->Get().SetCslTimeout(kCslTimeouts[0]); + sseds[0]->Get().SetCslChannel(kCslChannels[0]); + + nexus.AdvanceTime(kStabilizationTime); + + Log("Step 3: Leader"); + + /** + * Step 3: Leader + * - Description: Harness verifies connectivity by instructing the + * device to send an ICMPv6 Echo Request to each SSED mesh-local + * address. + * - Pass Criteria: + * - 3.1: The DUT MUST forward the ICMPv6 Echo Requests to SSED_1 + * and SSED_6 on the correct channel. + * - 3.2: SSED_1 MUST NOT send a MAC Data Request prior to + * receiving the ICMPv6 Echo Request from the Leader. + */ + + auto sendEchoRequests = [&](uint16_t aIdentifier) { + for (Node *ssed : sseds) + { + leader.SendEchoRequest(ssed->Get().GetMeshLocalEid(), aIdentifier, kEchoPayloadSize); + nexus.AdvanceTime(1000); + } + }; + + sendEchoRequests(kEchoIdentifierStep3); + + nexus.AdvanceTime(kStabilizationTime); + + Log("Step 4: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6"); + + /** + * Step 4: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 + * - Description: Each device automatically replies with ICMPv6 Echo + * Reply. The CSL unsynchronized timer on the DUT should be reset + * to 0. + * - Pass Criteria: + * - 4.1: The 802.15.4 Frame Headers for the SSED_1 and SSED_6 + * ICMPv6 Echo Replies MUST include the CSL Period IE and CSL + * Phase IE. + * - 4.2: The DUT MUST forward an ICMPv6 Echo Reply from SSED_1. + * - 4.3: The DUT MUST forward an ICMPv6 Echo Reply from SSED_2. + * - 4.4: The DUT MUST forward an ICMPv6 Echo Reply from SSED_3. + * - 4.5: The DUT MUST forward an ICMPv6 Echo Reply from SSED_4. + * - 4.6: The DUT MUST forward an ICMPv6 Echo Reply from SSED_5. + * - 4.7: The DUT MUST forward an ICMPv6 Echo Reply from SSED_6. + */ + + nexus.AdvanceTime(kStabilizationTime); + + Log("Step 5: Harness"); + + /** + * Step 5: Harness + * - Description: Harness waits for 35 seconds. + * - Pass Criteria: N/A + */ + + nexus.AdvanceTime(kWaitTime35s); + + Log("Step 6: Leader"); + + /** + * Step 6: Leader + * - Description: Harness verifies connectivity by instructing the + * device to send an ICMPv6 Echo Request to each SSED mesh-local + * address. + * - Pass Criteria: + * - 6.1: The DUT MUST forward the ICMPv6 Echo Requests to SSED_1 + * and SSED_6 on the correct channel. + * - 6.2: SSED_1 MUST NOT send a MAC Data Request prior to + * receiving the ICMPv6 Echo Request from the Leader. + */ + + sendEchoRequests(kEchoIdentifierStep6); + + nexus.AdvanceTime(kStabilizationTime); + + Log("Step 7: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6"); + + /** + * Step 7: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 + * - Description: Each device automatically replies with ICMPv6 Echo + * Reply. The CSL unsynchronized timer on the DUT should be reset + * to 0. + * - Pass Criteria: + * - 7.1: The 802.15.4 Frame Headers for the SSED_1 and SSED_6 + * ICMPv6 Echo Replies MUST include the CSL Period IE and CSL + * Phase IE. + * - 7.2: The DUT MUST forward an ICMPv6 Echo Reply from SSED_1. + * - 7.3: The DUT MUST forward an ICMPv6 Echo Reply from SSED_2. + * - 7.4: The DUT MUST forward an ICMPv6 Echo Reply from SSED_3. + * - 7.5: The DUT MUST forward an ICMPv6 Echo Reply from SSED_4. + * - 7.6: The DUT MUST forward an ICMPv6 Echo Reply from SSED_5. + * - 7.7: The DUT MUST forward an ICMPv6 Echo Reply from SSED_6. + */ + + nexus.AdvanceTime(kStabilizationTime); + + nexus.SaveTestInfo("test_1_2_LP_5_3_5.json"); +} + +} // namespace Nexus +} // namespace ot + +int main(void) +{ + ot::Nexus::Test1_2_LP_5_3_5(); + printf("All tests passed\n"); + return 0; +} diff --git a/tests/nexus/verify_1_2_LP_5_3_5.py b/tests/nexus/verify_1_2_LP_5_3_5.py new file mode 100644 index 000000000..437cc0d74 --- /dev/null +++ b/tests/nexus/verify_1_2_LP_5_3_5.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2026, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +import sys +import verify_utils +from pktverify import consts + +# Constants from C++ test +ECHO_IDENTIFIER_STEP3 = 0x1234 +ECHO_IDENTIFIER_STEP6 = 0x5678 +PRIMARY_CHANNEL = 11 +SECONDARY_CHANNEL = 26 + + +def verify(pv): + # 5.3.5 Minimum number of SSED Support + # + # 5.3.5.1 Topology + # - Leader + # - Router_1 (DUT) + # - SSED_1 + # - SSED_2 + # - SSED_3 + # - SSED_4 + # - SSED_5 + # - SSED_6 + # + # 5.3.5.2 Purpose and Description + # The purpose of this test is to verify that a Router can reliably support + # a minimum of 6 SSED children simultaneously that are each using a + # different CSL channel. + # + # - SSED_1 and SSED_2 are each configured with a CSL Synchronized + # Timeout of 10 seconds. + # - SSED_3 and SSED_4 are each configured with a CSL Synchronized + # Timeout of 20 seconds. + # - SSED_5 and SSED_6 are each configured with a CSL Synchronized + # Timeout of 30 seconds. + # + # SSED 1 and 6 are configured to use the Primary and Secondary harness + # channels, respectively. The other four SSEDs are configured to run + # on another four available random channels. No over-the-air + # captures are generated for these four SSEDs. + # + # SPEC Section: 3.2.6.3.2 + + pkts = pv.pkts + pv.summary.show() + + DUT = pv.vars['DUT'] + LEADER = pv.vars['LEADER'] + + NUM_SSEDS = 6 + SSEDS = [pv.vars[f'SSED_{i}'] for i in range(1, NUM_SSEDS + 1)] + SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 = SSEDS + + LEADER_MLEID = pv.vars['LEADER_MLEID'] + SSED_MLEIDS = [pv.vars[f'SSED_{i}_MLEID'] for i in range(1, NUM_SSEDS + 1)] + SSED_1_MLEID, SSED_2_MLEID, SSED_3_MLEID, SSED_4_MLEID, SSED_5_MLEID, SSED_6_MLEID = SSED_MLEIDS + + # Use RLOC16s from JSON as they are reliable in Nexus + def _to_int(val): + return int(val, 16) if isinstance(val, str) else val + + DUT_RLOC16 = _to_int(pv.vars['DUT_RLOC16']) + LEADER_RLOC16 = _to_int(pv.vars['LEADER_RLOC16']) + + # Step 0: SSED_1-6 + # - Description: Preconditions: + # - Set CSL Period = 500ms + # - SSED_1, _2: Set CSL Synchronized Timeout = 10s + # - SSED_3, _4: Set CSL Synchronized Timeout = 20s + # - SSED_5, _6: Set CSL Synchronized Timeout = 30s + # - Pass Criteria: N/A + print("Step 0: SSED_1-6") + + # Step 1: All + # - Description: Topology formation: DUT, SSED_1, SSED_2, SSED_3, + # SSED_4, SSED_5, SSED_6. + # - Pass Criteria: N/A + print("Step 1: All") + + # Just advance past some initial advertisements to establish a baseline + pkts.filter_wpan_src64(DUT).filter_mle_cmd(consts.MLE_ADVERTISEMENT).must_next() + + # Step 2: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 + # - Description: Each device automatically attaches to the DUT and + # establishes CSL synchronization. + # - Pass Criteria: + # - 2.1: The DUT MUST unicast MLE Child ID Response to SSED_1. + # - 2.2: The DUT MUST unicast MLE Child Update Response to SSED_1. + # - 2.3: The DUT MUST unicast MLE Child ID Response to SSED_2. + # - 2.4: The DUT MUST unicast MLE Child ID Response to SSED_3. + # - 2.5: The DUT MUST unicast MLE Child ID Response to SSED_4. + # - 2.6: The DUT MUST unicast MLE Child ID Response to SSED_5. + # - 2.7: The DUT MUST unicast MLE Child ID Response to SSED_6. + print("Step 2: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6") + + # 2.1, 2.3-2.7: The DUT MUST unicast MLE Child ID Response to SSED_1-6. + for ssed in SSEDS: + with pkts.save_index(): + pkts.filter_wpan_src64(DUT).\ + filter_wpan_dst64(ssed).\ + filter_mle_cmd(consts.MLE_CHILD_ID_RESPONSE).\ + must_next() + + # 2.2: The DUT MUST unicast MLE Child Update Response to SSED_1. + with pkts.save_index(): + pkts.filter_wpan_src64(DUT).\ + filter_wpan_dst64(SSED_1).\ + filter_mle_cmd(consts.MLE_CHILD_UPDATE_RESPONSE).\ + must_next() + + # Advance index past Step 2 by finding the last packet of this phase, + # which is the Child Update Response to SSED_1. + pkts.filter_wpan_src64(DUT).\ + filter_wpan_dst64(SSED_1).\ + filter_mle_cmd(consts.MLE_CHILD_UPDATE_RESPONSE).\ + must_next() + + def _verify_echo_cycle(step_str, echo_identifier): + print(f"Step {step_str}: Leader") + start_index = pkts.index + + # Echo Request from LEADER to DUT (for SSED_1) + # We allow any source address from the leader as long as it's to SSED_1 and uses correct RLOC16s + with pkts.save_index(): + _echo_req_leader_to_dut = pkts.filter_ping_request(identifier=echo_identifier).\ + filter_ipv6_dst(SSED_1_MLEID).\ + filter_wpan_src16(LEADER_RLOC16).\ + filter_wpan_dst16(DUT_RLOC16).\ + must_next() + _idx1 = pkts.index + + # Forwarded Echo Request to SSED_1 + with pkts.save_index(): + _echo_req_ssed1 = pkts.filter_ping_request(identifier=echo_identifier).\ + filter_wpan_src16(DUT_RLOC16).\ + filter_ipv6_dst(SSED_1_MLEID).\ + filter(lambda p: p.wpan.channel == PRIMARY_CHANNEL).\ + must_next() + _idx2 = pkts.index + + # Forwarded Echo Request to SSED_6 + with pkts.save_index(): + pkts.filter_ping_request(identifier=echo_identifier).\ + filter_wpan_src16(DUT_RLOC16).\ + filter_ipv6_dst(SSED_6_MLEID).\ + filter(lambda p: p.wpan.channel == SECONDARY_CHANNEL).\ + must_next() + + # SSED_1 MUST NOT send a MAC Data Request prior to receiving the + # ICMPv6 Echo Request + pkts.range(_idx1, _idx2).\ + filter_wpan_src64(SSED_1).\ + filter_wpan_cmd(consts.WPAN_DATA_REQUEST).\ + must_not_next() + + print(f"Step {int(step_str)+1}: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6") + + # Check for CSL IEs in Echo Replies from SSED_1 and SSED_6 + with pkts.save_index(): + pkts.filter_ping_reply(identifier=echo_identifier).\ + filter_wpan_src64(SSED_1).\ + filter_wpan_dst16(DUT_RLOC16).\ + filter(lambda p: consts.CSL_IE_ID in p.wpan.header_ie.id).\ + must_next() + + with pkts.save_index(): + pkts.filter_ping_reply(identifier=echo_identifier).\ + filter_wpan_src64(SSED_6).\ + filter_wpan_dst16(DUT_RLOC16).\ + filter(lambda p: consts.CSL_IE_ID in p.wpan.header_ie.id).\ + must_next() + + # DUT MUST forward an ICMPv6 Echo Reply from all SSEDs + for ssed_mleid in SSED_MLEIDS: + with pkts.save_index(): + pkts.filter_ping_reply(identifier=echo_identifier).\ + filter_wpan_src16(DUT_RLOC16).\ + filter_wpan_dst16(LEADER_RLOC16).\ + filter_ipv6_src(ssed_mleid).\ + must_next() + + # Advance index past replies by finding the last one, which is from SSED_6. + pkts.filter_ping_reply(identifier=echo_identifier).\ + filter_wpan_src16(DUT_RLOC16).\ + filter_wpan_dst16(LEADER_RLOC16).\ + filter_ipv6_src(SSED_6_MLEID).\ + must_next() + + # Step 3: Leader + # - Description: Harness verifies connectivity by instructing the + # device to send an ICMPv6 Echo Request to each SSED mesh-local + # address. + # - Pass Criteria: + # - 3.1: The DUT MUST forward the ICMPv6 Echo Requests to SSED_1 + # and SSED_6 on the correct channel. + # - 3.2: SSED_1 MUST NOT send a MAC Data Request prior to + # receiving the ICMPv6 Echo Request from the Leader. + # + # Step 4: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 + # - Description: Each device automatically replies with ICMPv6 Echo + # Reply. The CSL unsynchronized timer on the DUT should be reset + # to 0. + # - Pass Criteria: + # - 4.1: The 802.15.4 Frame Headers for the SSED_1 and SSED_6 + # ICMPv6 Echo Replies MUST include the CSL Period IE and CSL + # Phase IE. + # - 4.2: The DUT MUST forward an ICMPv6 Echo Reply from SSED_1. + # - 4.3: The DUT MUST forward an ICMPv6 Echo Reply from SSED_2. + # - 4.4: The DUT MUST forward an ICMPv6 Echo Reply from SSED_3. + # - 4.5: The DUT MUST forward an ICMPv6 Echo Reply from SSED_4. + # - 4.6: The DUT MUST forward an ICMPv6 Echo Reply from SSED_5. + # - 4.7: The DUT MUST forward an ICMPv6 Echo Reply from SSED_6. + _verify_echo_cycle('3', ECHO_IDENTIFIER_STEP3) + + # Step 5: Harness + # - Description: Harness waits for 35 seconds. + # - Pass Criteria: N/A + print("Step 5: Harness") + + # Step 6: Leader + # - Description: Harness verifies connectivity by instructing the + # device to send an ICMPv6 Echo Request to each SSED mesh-local + # address. + # - Pass Criteria: + # - 6.1: The DUT MUST forward the ICMPv6 Echo Requests to SSED_1 + # and SSED_6 on the correct channel. + # - 6.2: SSED_1 MUST NOT send a MAC Data Request prior to + # receiving the ICMPv6 Echo Request from the Leader. + # + # Step 7: SSED_1, SSED_2, SSED_3, SSED_4, SSED_5, SSED_6 + # - Description: Each device automatically replies with ICMPv6 Echo + # Reply. The CSL unsynchronized timer on the DUT should be reset + # to 0. + # - Pass Criteria: + # - 7.1: The 802.15.4 Frame Headers for the SSED_1 and SSED_6 + # ICMPv6 Echo Replies MUST include the CSL Period IE and CSL + # Phase IE. + # - 7.2: The DUT MUST forward an ICMPv6 Echo Reply from SSED_1. + # - 7.3: The DUT MUST forward an ICMPv6 Echo Reply from SSED_2. + # - 7.4: The DUT MUST forward an ICMPv6 Echo Reply from SSED_3. + # - 7.5: The DUT MUST forward an ICMPv6 Echo Reply from SSED_4. + # - 7.6: The DUT MUST forward an ICMPv6 Echo Reply from SSED_5. + # - 7.7: The DUT MUST forward an ICMPv6 Echo Reply from SSED_6. + _verify_echo_cycle('6', ECHO_IDENTIFIER_STEP6) + + +if __name__ == '__main__': + verify_utils.run_main(verify)