[nexus] add test 5.6.1 Network data propagation – Leader as BR (#12450)

This commit adds a new Nexus test case 5.6.1 which verifies that
the DUT correctly sets the Network Data (stable/non-stable) received
during the attaching procedure and propagates it properly to
devices that attach to it.

The test setup uses a Leader configured as a Border Router with
both stable and non-stable prefixes. It verifies that children
attaching to the DUT (Router_1) receive the appropriate network
data based on their requested mode (full vs. stable-only).

Summary of changes:
- Created tests/nexus/test_5_6_1.cpp:
    - Implements test execution using direct C++ method calls.
    - Uses AllowList to define specific node links.
    - Includes 1-line log outputs for each test specification step.
- Created tests/nexus/verify_5_6_1.py:
    - Implements pcap-based verification of PASS criteria.
    - Checks for stable/non-stable Network Data propagation.
    - Validates 6LoWPAN fragmentation and MAC security.
    - Verifies address registration and ICMPv6 connectivity.
- Updated tests/nexus/CMakeLists.txt to include the new test.
- Updated tests/nexus/run_nexus_tests.sh to add 5_6_1 to the default
  test list.
This commit is contained in:
Jonathan Hui
2026-02-18 09:04:29 -06:00
committed by GitHub
parent 6501c88c07
commit fd2bcdafdc
4 changed files with 422 additions and 0 deletions
+1
View File
@@ -155,6 +155,7 @@ ot_nexus_test(5_5_4_1 "cert;nexus")
ot_nexus_test(5_5_4_2 "cert;nexus")
ot_nexus_test(5_5_5 "cert;nexus")
ot_nexus_test(5_5_7 "cert;nexus")
ot_nexus_test(5_6_1 "cert;nexus")
ot_nexus_test(5_7_1 "cert;nexus")
ot_nexus_test(5_7_2 "cert;nexus")
ot_nexus_test(5_7_3 "cert;nexus")
+1
View File
@@ -85,6 +85,7 @@ DEFAULT_TESTS=(
"5_5_4_2"
"5_5_5"
"5_5_7"
"5_6_1"
"5_7_1"
"5_7_2"
"5_7_3"
+253
View File
@@ -0,0 +1,253 @@
/*
* 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 the network to stabilize after routers have attached.
*/
static constexpr uint32_t kStabilizationTime = 10 * 1000;
void Test5_6_1(void)
{
/**
* 5.6.1 Network data propagation (BR exists during attach) Leader as BR
*
* 5.6.1.1 Topology
* - Leader is configured as a Border Router.
* - MED_1 is configured to require the full network data.
* - SED_1 is configured to request only the stable network data.
*
* 5.6.1.2 Purpose & Description
* The purpose of this test case is to verify that the DUT correctly sets the Network Data (stable/non-stable)
* received during the attaching procedure and propagates it properly to devices that attach to it.
*
* Spec Reference | V1.1 Section | V1.3.0 Section
* ---------------------------------------------------|--------------|---------------
* Thread Network Data / Network Data and Propagation | 5.13 / 5.15 | 5.13 / 5.15
*/
Core nexus;
Node &leader = nexus.CreateNode();
Node &router1 = nexus.CreateNode();
Node &med1 = nexus.CreateNode();
Node &sed1 = nexus.CreateNode();
leader.SetName("LEADER");
router1.SetName("ROUTER_1");
med1.SetName("MED_1");
sed1.SetName("SED_1");
const char *kPrefix1 = "2001::/64";
const char *kPrefix2 = "2002::/64";
const char *kPrefix3 = "2003::/64";
const char *kPrefix4 = "2004::/64";
/**
* - Use AllowList to specify links between nodes. There is a link between the following node pairs:
* - Router 1 (DUT) and Leader
* - Router 1 (DUT) and MED 1
* - Router 1 (DUT) and SED 1
*/
router1.AllowList(leader);
router1.AllowList(med1);
router1.AllowList(sed1);
leader.AllowList(router1);
med1.AllowList(router1);
sed1.AllowList(router1);
nexus.AdvanceTime(0);
Instance::SetLogLevel(kLogLevelNote);
Log("---------------------------------------------------------------------------------------");
/**
* Step 1: Leader
* - Description: Forms the network and sends MLE Advertisements.
*/
Log("Step 1: Leader forms the network and sends MLE Advertisements.");
leader.Form();
nexus.AdvanceTime(kFormNetworkTime);
VerifyOrQuit(leader.Get<Mle::Mle>().IsLeader());
Log("---------------------------------------------------------------------------------------");
/**
* Step 2: Leader
* - Description: Harness configures the device as a Border Router with the following On-Mesh Prefix Set:
* - Prefix 1: P_prefix=2001::/64 P_stable=1 P_on_mesh=1 P_preferred=1 P_slaac=1 P_default=1
* - Prefix 2: P_prefix=2002::/64 P_stable=0 P_on_mesh=1 P_preferred=1 P_slaac=1 P_default=1
* - Prefix 3: P_prefix=2003::/64 P_stable=1 P_on_mesh=1 P_preferred=1 P_slaac=1 P_default=1
* - Prefix 4: P_prefix=2004::/64 P_stable=1 P_on_mesh=1 P_preferred=1 P_slaac=1 P_default=1
*/
Log("Step 2: Leader configures as a Border Router with 4 prefixes.");
{
const struct
{
const char *mPrefix;
bool mIsStable;
} kPrefixes[] = {
{kPrefix1, true},
{kPrefix2, false},
{kPrefix3, true},
{kPrefix4, true},
};
for (const auto &prefixInfo : kPrefixes)
{
NetworkData::OnMeshPrefixConfig config;
SuccessOrQuit(config.GetPrefix().FromString(prefixInfo.mPrefix));
config.mStable = prefixInfo.mIsStable;
config.mOnMesh = true;
config.mPreferred = true;
config.mSlaac = true;
config.mDefaultRoute = true;
SuccessOrQuit(leader.Get<NetworkData::Local>().AddOnMeshPrefix(config));
}
leader.Get<NetworkData::Notifier>().HandleServerDataUpdated();
}
nexus.AdvanceTime(kStabilizationTime);
Log("---------------------------------------------------------------------------------------");
/**
* Step 3: Router_1 (DUT)
* - Description: Automatically attaches to the Leader.
*/
Log("Step 3: Router_1 (DUT) automatically attaches to the Leader.");
router1.Join(leader, Node::kAsFtd);
nexus.AdvanceTime(kAttachToRouterTime);
VerifyOrQuit(router1.Get<Mle::Mle>().IsRouter());
Log("---------------------------------------------------------------------------------------");
/**
* Step 4: Leader
* - Description: Automatically includes the Network Data TLV in the MLE Child ID Response with the following
* fields:
* - Four Prefix TLVs (one for each prefix set 1-4), each including:
* - 6LoWPAN ID sub-TLV
* - Border Router sub-TLV
* - (Router_1 requests complete network data (Mode TLV))
*/
Log("Step 4: Leader includes the Network Data TLV in the MLE Child ID Response.");
Log("---------------------------------------------------------------------------------------");
/**
* Step 5: SED_1
* - Description: Harness instructs the device to attach to the DUT; SED_1 requests only the stable Network Data.
*/
Log("Step 5: SED_1 attaches to the DUT; SED_1 requests only the stable Network Data.");
sed1.Join(router1, Node::kAsSed);
nexus.AdvanceTime(kAttachToRouterTime);
VerifyOrQuit(sed1.Get<Mle::Mle>().IsChild());
Log("---------------------------------------------------------------------------------------");
/**
* Step 6: Router_1 (DUT)
* - Description: Automatically sends MLE Parent Response and MLE Child ID Response to SED_1.
*/
Log("Step 6: Router_1 (DUT) automatically sends MLE Parent Response and MLE Child ID Response to SED_1.");
Log("---------------------------------------------------------------------------------------");
/**
* Step 7: MED_1
* - Description: Harness instructs the device to attach to the DUT; MED_1 requests the full Network Data.
*/
Log("Step 7: MED_1 attaches to the DUT; MED_1 requests the full Network Data.");
med1.Join(router1, Node::kAsMed);
nexus.AdvanceTime(kAttachToRouterTime);
VerifyOrQuit(med1.Get<Mle::Mle>().IsChild());
Log("---------------------------------------------------------------------------------------");
/**
* Step 8: Router_1 (DUT)
* - Description: Automatically sends MLE Parent Response and MLE Child ID Response to MED_1.
*/
Log("Step 8: Router_1 (DUT) automatically sends MLE Parent Response and MLE Child ID Response to MED_1.");
Log("---------------------------------------------------------------------------------------");
/**
* Step 9: SED_1, MED_1
* - Description: Automatically send addresses configured in the Address Registration TLV to their parent in a MLE
* Child Update Request command.
*/
Log("Step 9: SED_1, MED_1 automatically send addresses in a MLE Child Update Request.");
Log("---------------------------------------------------------------------------------------");
/**
* Step 10: Router_1 (DUT)
* - Description: Automatically sends MLE Child Update Response to SED_1 and MED_1.
*/
Log("Step 10: Router_1 (DUT) automatically sends MLE Child Update Response to SED_1 and MED_1.");
nexus.AdvanceTime(20 * 1000);
Log("---------------------------------------------------------------------------------------");
/**
* Step 11: Leader
* - Description: Harness instructs the device to send an ICMPv6 Echo Request to the DUT GUA addresses configured
* from Prefix 1, Prefix 2, Prefix 3 and Prefix 4.
*/
Log("Step 11: Leader sends an ICMPv6 Echo Request to the DUT GUA addresses.");
nexus.AdvanceTime(kStabilizationTime);
nexus.SendAndVerifyEchoRequest(leader, router1.FindMatchingAddress(kPrefix1));
nexus.SendAndVerifyEchoRequest(leader, router1.FindMatchingAddress(kPrefix2));
nexus.SendAndVerifyEchoRequest(leader, router1.FindMatchingAddress(kPrefix3));
nexus.SendAndVerifyEchoRequest(leader, router1.FindMatchingAddress(kPrefix4));
nexus.SaveTestInfo("test_5_6_1.json");
Log("Test 5.6.1 passed");
}
} // namespace Nexus
} // namespace ot
int main(void)
{
ot::Nexus::Test5_6_1();
printf("All tests passed\n");
return 0;
}
+167
View File
@@ -0,0 +1,167 @@
#!/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.addrs import Ipv6Addr
def verify(pv):
pkts = pv.pkts
pv.summary.show()
LEADER = pv.vars['LEADER']
ROUTER_1 = pv.vars['ROUTER_1']
MED_1 = pv.vars['MED_1']
SED_1 = pv.vars['SED_1']
LEADER_RLOC16 = pv.vars['LEADER_RLOC16']
ROUTER_1_RLOC16 = pv.vars['ROUTER_1_RLOC16']
# Step 1: Leader forms the network
print("Step 1: Leader forms the network and sends MLE Advertisements.")
pkts.filter_wpan_src64(LEADER).\
filter_mle_cmd(consts.MLE_ADVERTISEMENT).\
must_next()
# Step 2: Leader configured as BR
print("Step 2: Leader configures as a Border Router with 4 prefixes.")
# Step 3: Router_1 (DUT) attaches to Leader
print("Step 3: Router_1 (DUT) attaches to the Leader and requests Network Data TLV.")
pkts.filter_wpan_src64(ROUTER_1).\
filter_mle_cmd(consts.MLE_CHILD_ID_REQUEST).\
filter(lambda p: {
consts.TLV_REQUEST_TLV,
consts.NETWORK_DATA_TLV
} <= set(p.mle.tlv.type)).\
must_next()
# Step 4: Leader responds with 4 prefixes
print("Step 4: Leader includes the Network Data TLV in the MLE Child ID Response.")
pkts.filter_wpan_src64(LEADER).\
filter_wpan_dst64(ROUTER_1).\
filter_mle_cmd(consts.MLE_CHILD_ID_RESPONSE).\
filter(lambda p: {
Ipv6Addr("2001::"),
Ipv6Addr("2002::"),
Ipv6Addr("2003::"),
Ipv6Addr("2004::")
} <= set(p.thread_nwd.tlv.prefix)).\
must_next()
# Step 5: SED_1 attaches to DUT
print("Step 5: SED_1 attaches to the DUT and requests only stable Network Data.")
# Step 6: Router_1 responds to SED_1 with stable net data only
print("Step 6: Router_1 (DUT) sends MLE Child ID Response to SED_1 with stable Network Data.")
pkts.filter_wpan_src64(ROUTER_1).\
filter_wpan_dst64(SED_1).\
filter_mle_cmd(consts.MLE_CHILD_ID_RESPONSE).\
filter(lambda p: {
Ipv6Addr("2001::"),
Ipv6Addr("2003::"),
Ipv6Addr("2004::")
} <= set(p.thread_nwd.tlv.prefix)).\
filter(lambda p: Ipv6Addr("2002::") not in p.thread_nwd.tlv.prefix).\
filter(lambda p: all(rloc == 0xfffe for rloc in p.thread_nwd.tlv.border_router_16)).\
filter(lambda p: hasattr(p, 'lowpan') and hasattr(p.lowpan, 'fragment')).\
filter(lambda p: p.wpan.aux_sec.sec_level == 5).\
must_next()
# Step 7: MED_1 attaches to DUT
print("Step 7: MED_1 attaches to the DUT and requests full Network Data.")
# Step 8: Router_1 responds to MED_1 with full net data
print("Step 8: Router_1 (DUT) sends MLE Child ID Response to MED_1 with full Network Data.")
pkts.filter_wpan_src64(ROUTER_1).\
filter_wpan_dst64(MED_1).\
filter_mle_cmd(consts.MLE_CHILD_ID_RESPONSE).\
filter(lambda p: {
Ipv6Addr("2001::"),
Ipv6Addr("2002::"),
Ipv6Addr("2003::"),
Ipv6Addr("2004::")
} <= set(p.thread_nwd.tlv.prefix)).\
filter(lambda p: hasattr(p, 'lowpan') and hasattr(p.lowpan, 'fragment')).\
filter(lambda p: p.wpan.aux_sec.sec_level == 5).\
must_next()
# Step 9 & 10: Child Update messages
print("Step 9 & 10: Verifying MLE Child Update messages.")
def verify_child_update(child_ext64, expected_addr_count):
# Find Child Update Request from child
pkts.copy().\
filter_wpan_src64(child_ext64).\
filter_wpan_dst64(ROUTER_1).\
filter_mle_cmd(consts.MLE_CHILD_UPDATE_REQUEST).\
filter(lambda p: consts.ADDRESS_REGISTRATION_TLV in p.mle.tlv.type).\
must_next()
# Find Child Update Response from DUT
pkts.copy().\
filter_wpan_src64(ROUTER_1).\
filter_wpan_dst64(child_ext64).\
filter_mle_cmd(consts.MLE_CHILD_UPDATE_RESPONSE).\
filter(lambda p: {
consts.SOURCE_ADDRESS_TLV,
consts.LEADER_DATA_TLV,
consts.ADDRESS_REGISTRATION_TLV,
consts.MODE_TLV
} <= set(p.mle.tlv.type)).\
filter(lambda p: len(p.mle.tlv.addr_reg_iid) >= expected_addr_count).\
must_next()
verify_child_update(SED_1, 3)
verify_child_update(MED_1, 4)
# Step 11: Leader pings DUT
print("Step 11: Leader sends ICMPv6 Echo Request to the DUT GUA addresses.")
for _ in range(4):
_pkt = pkts.filter_ping_request().\
filter(lambda p: not str(p.ipv6.dst).startswith("fe80")).\
filter_wpan_src16(LEADER_RLOC16).\
filter_wpan_dst16(ROUTER_1_RLOC16).\
must_next()
pkts.filter_ping_reply(identifier=_pkt.icmpv6.echo.identifier).\
filter_wpan_src16(ROUTER_1_RLOC16).\
filter_wpan_dst16(LEADER_RLOC16).\
must_next()
if __name__ == '__main__':
verify_utils.run_main(verify)