[nexus] add test 1.2.LP.5.3.1 for SSED attachment (#12594)

This commit adds a new Nexus test case 1.2.LP.5.3.1 which validates
SSED attachment and CSL synchronization.

Changes:
- Added kAsSsed JoinMode to Nexus::Node platform to support joining
  as a Synchronized Sleepy End Device with default CSL parameters.
- Implemented test_1_2_LP_5_3_1.cpp following the test specification
  for SSED attachment.
- Implemented verify_1_2_LP_5_3_1.py to verify pcap output, ensuring
  correct use of 802.15.4-2015 frames and CSL synchronization.
- Updated CMakeLists.txt and run_nexus_tests.sh to include the new
  test in the Nexus test suite.
This commit is contained in:
Jonathan Hui
2026-03-03 18:05:15 -06:00
committed by GitHub
parent 202d5df96d
commit e5169ea810
6 changed files with 309 additions and 1 deletions
+1 -1
View File
@@ -118,7 +118,6 @@ endmacro()
#----------------------------------------------------------------------------------------------------------------------
# Cert tests
ot_nexus_test(1_1_5_1_1 "cert;nexus")
ot_nexus_test(1_1_5_1_2 "cert;nexus")
@@ -216,6 +215,7 @@ ot_nexus_test(1_1_9_2_16 "cert;nexus")
ot_nexus_test(1_1_9_2_17 "cert;nexus")
ot_nexus_test(1_1_9_2_18 "cert;nexus")
ot_nexus_test(1_1_9_2_19 "cert;nexus")
ot_nexus_test(1_2_LP_5_3_1 "cert;nexus")
# Misc tests
ot_nexus_test(border_admitter "core;nexus")
+9
View File
@@ -87,6 +87,15 @@ void Node::Join(Node &aNode, JoinMode aJoinMode)
break;
case kAsSed:
break;
case kAsSsed:
{
static constexpr uint32_t kDefaultCslPeriod = 100 * 1000 / OT_US_PER_TEN_SYMBOLS; // 100 ms
static constexpr uint32_t kDefaultCslTimeout = 30; // 30 seconds
Get<Mac::Mac>().SetCslPeriod(kDefaultCslPeriod);
Get<Mle::Mle>().SetCslTimeout(kDefaultCslTimeout);
break;
}
}
SuccessOrQuit(Get<Mle::Mle>().SetDeviceMode(Mle::DeviceMode(mode)));
+1
View File
@@ -79,6 +79,7 @@ public:
kAsFed,
kAsMed,
kAsSed,
kAsSsed,
kAsSedWithFullNetData,
};
+1
View File
@@ -150,6 +150,7 @@ DEFAULT_TESTS=(
"1_1_9_2_17"
"1_1_9_2_18"
"1_1_9_2_19"
"1_2_LP_5_3_1"
)
# Use provided arguments or the default test list
+167
View File
@@ -0,0 +1,167 @@
/*
* 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 <stdio.h>
#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;
/**
* Payload size for a standard ICMPv6 Echo Request.
*/
static constexpr uint16_t kEchoPayloadSize = 10;
void Test1_2_LP_5_3_1(void)
{
/**
* 5.3.1 SSED Attachment
*
* 5.3.1.1 Topology
* - Leader (DUT)
* - Router_1
* - SSED_1
*
* 5.3.1.2 Purpose & Description
* The purpose of this test is to validate that the DUT can successfully support a SSED that establishes CSL
* Synchronization after attach using Child Update Request.
*
* Spec Reference | V1.2 Section
* -----------------|--------------
* SSED Attachment | 4.6.5.2
*/
Core nexus;
Node &leader = nexus.CreateNode();
Node &router1 = nexus.CreateNode();
Node &ssed1 = nexus.CreateNode();
leader.SetName("LEADER");
router1.SetName("ROUTER_1");
ssed1.SetName("SSED_1");
nexus.AdvanceTime(0);
Instance::SetLogLevel(kLogLevelNote);
Log("---------------------------------------------------------------------------------------");
Log("Step 1: All");
/**
* Step 1: All
* - Description: Topology formation: DUT, Router_1, SSED_1.
* - Pass Criteria: N/A.
*/
/** Use AllowList feature to restrict the topology. */
leader.AllowList(router1);
leader.AllowList(ssed1);
router1.AllowList(leader);
ssed1.AllowList(leader);
leader.Form();
nexus.AdvanceTime(kFormNetworkTime);
VerifyOrQuit(leader.Get<Mle::Mle>().IsLeader());
router1.Join(leader);
nexus.AdvanceTime(kAttachToRouterTime);
VerifyOrQuit(router1.Get<Mle::Mle>().IsRouter());
Log("---------------------------------------------------------------------------------------");
Log("Step 2: SSED_1");
/**
* Step 2: SSED_1
* - Description: Automatically attaches to the DUT. Automatically initiates a CSL connection via a MLE Child
* Update Request that contains the CSL IEs and the CSL Synchronized Timeout TLV.
* - Pass Criteria: N/A.
*/
ssed1.Join(leader, Node::kAsSsed);
Log("---------------------------------------------------------------------------------------");
Log("Step 3: Leader (DUT)");
/**
* Step 3: Leader (DUT)
* - Description: Automatically completes the CSL connection with SSED_1 by unicasting MLE Child Update
* Response.
* - Pass Criteria: The DUT MUST unicast MLE Child Update Response to SSED_1.
* - The Frame Version of the packet MUST be: IEEE Std 802.15.4-2015 (value = 0b10).
*/
nexus.AdvanceTime(kAttachAsSsedTime);
VerifyOrQuit(ssed1.Get<Mle::Mle>().IsAttached());
Log("---------------------------------------------------------------------------------------");
Log("Step 4: Router_1");
/**
* Step 4: Router_1
* - Description: Harness verifies connectivity by instructing the device to send an ICMPv6 Echo Request to the
* SSED_1 mesh-local address (via the DUT).
* - Pass Criteria:
* - The DUT MUST forward the ICMPv6 Echo Request to SSED_1.
* - The Frame Version of the packet MUST be: IEEE Std 802.15.4-2015 (value = 0b10).
* - SSED_1 MUST NOT send a MAC Data Request prior to receiving the ICMPv6 Echo Request from the Leader.
* - Router_1 MUST receive an ICMPv6 Echo Response from SSED_1.
*/
nexus.SendAndVerifyEchoRequest(router1, ssed1.Get<Mle::Mle>().GetMeshLocalEid(), kEchoPayloadSize);
nexus.SaveTestInfo("test_1_2_LP_5_3_1.json");
}
} // namespace Nexus
} // namespace ot
int main(void)
{
ot::Nexus::Test1_2_LP_5_3_1();
printf("All tests passed\n");
return 0;
}
+130
View File
@@ -0,0 +1,130 @@
#!/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 os
# Add the current directory to sys.path to find verify_utils
CUR_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(CUR_DIR)
import verify_utils
from pktverify import consts
from pktverify.null_field import nullField
def verify(pv):
# 5.3.1 SSED Attachment
#
# 5.3.1.1 Topology
# - Leader (DUT)
# - Router_1
# - SSED_1
#
# 5.3.1.2 Purpose & Description
# The purpose of this test is to validate that the DUT can successfully support a SSED that establishes CSL
# Synchronization after attach using Child Update Request.
#
# Spec Reference | V1.2 Section
# -----------------|--------------
# SSED Attachment | 4.6.5.2
pkts = pv.pkts
pv.summary.show()
LEADER = pv.vars['LEADER']
LEADER_RLOC16 = pv.vars['LEADER_RLOC16']
ROUTER_1 = pv.vars['ROUTER_1']
SSED_1 = pv.vars['SSED_1']
SSED_1_RLOC16 = pv.vars['SSED_1_RLOC16']
# Step 1: All
# - Description: Topology formation: DUT, Router_1, SSED_1.
# - Pass Criteria: N/A.
print("Step 1: Topology formation")
# Step 2: SSED_1
# - Description: Automatically attaches to the DUT. Automatically initiates a CSL connection via a MLE Child Update
# Request that contains the CSL IEs and the CSL Synchronized Timeout TLV.
# - Pass Criteria: N/A.
print("Step 2: SSED_1 attaches and initiates CSL connection")
pkts.filter_wpan_src64(SSED_1).\
filter_wpan_dst64(LEADER).\
filter_mle_cmd(consts.MLE_CHILD_UPDATE_REQUEST).\
filter(lambda p: {
consts.CSL_SYNCHRONIZED_TIMEOUT
} <= set(p.mle.tlv.type)).\
must_next()
# Step 3: Leader (DUT)
# - Description: Automatically completes the CSL connection with SSED_1 by unicasting MLE Child Update Response.
# - Pass Criteria: The DUT MUST unicast MLE Child Update Response to SSED_1.
# - The Frame Version of the packet MUST be: IEEE Std 802.15.4-2015 (value = 0b10).
print("Step 3: Leader completes CSL connection")
pkts.filter_wpan_src64(LEADER).\
filter_wpan_dst64(SSED_1).\
filter_mle_cmd(consts.MLE_CHILD_UPDATE_RESPONSE).\
filter(lambda p: p.wpan.version == 2).\
must_next()
# Step 4: Router_1
# - Description: Harness verifies connectivity by instructing the device to send an ICMPv6 Echo Request to the
# SSED_1 mesh-local address (via the DUT).
# - Pass Criteria:
# - The DUT MUST forward the ICMPv6 Echo Request to SSED_1.
# - The Frame Version of the packet MUST be: IEEE Std 802.15.4-2015 (value = 0b10).
# - SSED_1 MUST NOT send a MAC Data Request prior to receiving the ICMPv6 Echo Request from the Leader.
# - Router_1 MUST receive an ICMPv6 Echo Response from SSED_1.
print("Step 4: Router_1 sends Echo Request to SSED_1")
# Forwarded Echo Request from LEADER to SSED_1
_pkt = pkts.filter_ping_request().\
filter_wpan_src64(LEADER).\
filter_wpan_dst16(SSED_1_RLOC16).\
filter(lambda p: p.wpan.version == 2).\
must_next()
# SSED_1 MUST NOT send a MAC Data Request prior to receiving the ICMPv6 Echo Request from the Leader.
pkts.range((0, 0), (_pkt.number, _pkt.number)).\
filter_wpan_src64(SSED_1).\
filter_wpan_dst16(LEADER_RLOC16).\
filter_wpan_cmd(consts.WPAN_DATA_REQUEST).\
must_not_next()
# Echo Response from SSED_1 to ROUTER_1
pkts.filter_ping_reply(identifier=_pkt.icmpv6.echo.identifier).\
filter_wpan_src64(SSED_1).\
filter_wpan_dst16(LEADER_RLOC16).\
must_next()
if __name__ == '__main__':
verify_utils.run_main(verify)