This commit refactors the `OmrPrefixManager` to decouple it from the main
`RoutingManager` policy evaluation cycle. This allows the OMR prefix to
be managed independently and published faster into the Network Data.
Previously, `OmrPrefixManager` relied on its `Evaluate()` method being
called during the main `RoutingManager::EvaluateRoutingPolicy()` cycle.
This meant it had to wait for other components to be ready — such as
sending Router Solicitations to discover other routers on the Adjacent
Infrastructure Link (AIL)—before taking action.
With this change, `OmrPrefixManager` operates independently. It can
evaluate its state as soon as the Border Router function is enabled and
`Start()` is called.
Additional improvements supporting this independent operation include:
- Replaces the `mIsLocalAddedInNetData` boolean with a `LocalPrefixState`
enum (`kNotAdded`, `kToAdd`, `kAdded`) to manage addition state and
support delayed updates.
- Introduces a random delay (`kMinDelayToAdd` to `kMaxDelayToAdd`)
before adding a self-generated OMR prefix to Network Data. This gives
the network time to settle, allowing other BRs or the `PdPrefixManager`
time to establish a prefix.
- Implements a retry mechanism with jitter for Network Data addition
failures, rather than silently ignoring them.
- Refactors `PdPrefixManager` to batch state changes via an `mEvents`
bitmask and process them through `mEventTask`. Changes are now handled
explicitly by `OmrPrefixManager::HandlePdPrefixManagerEvent()`, further
reducing unnecessary main routing policy evaluations.
This commit adds an API otDatasetIsValid to check whether the given
Operational Dataset contains all the required TLVs (Active Timestamp,
Channel, Channel Mask, Extended PAN ID, Mesh-Local Prefix, Network
Key, Network Name, PAN ID, PSKc, and Security Policy). This API also
checks whether there are duplicated TLVs or the TLVs are not
well-formed.
This commit removes three Python-based thread-cert scripts for v1.2
backbone router and multicast registration testing:
- v1_2_test_backbone_router_service.py
- v1_2_test_multicast_listener_registration.py
- v1_2_test_multicast_registration.py
These tests have been fully migrated to the Nexus simulation
framework, providing equivalent verification in a more robust and
scalable environment.
The equivalent Nexus test cases are already part of the repository:
- 1_2_BBR_TC_1, 1_2_BBR_TC_2, 1_2_BBR_TC_3
- 1_2_MATN_TC_1, 1_2_MATN_TC_2, ..., 1_2_MATN_TC_26
This commit adds the Nexus test case 1_3_SRP_TC_5 which verifies SRP
KEY record inclusion and omission behavior according to the Thread 1.3
test specification (SRP TC-5).
The implementation includes:
- Adding mHostKeyRecordEnabled flag to Srp::Client to control host
KEY record inclusion in SRP Updates. This is enabled only when
OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE is defined.
- Implementing SetHostKeyRecordEnabled() and IsHostKeyRecordEnabled()
methods in Srp::Client.
- Modifying AppendHostDescriptionInstruction() in srp_client.cpp
to conditionally include the KEY record.
- Creating tests/nexus/test_1_3_SRP_TC_5.cpp to execute the test
sequence across multiple simulated nodes (BR_1, ED_1, Eth_1).
- Creating tests/nexus/verify_1_3_SRP_TC_5.py to perform automated
verification of the captured traffic.
- Updating tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to include the new test.
The test ensures that the SRP server correctly handles updates with
and without service KEY records, omits KEY records in DNS/mDNS
responses, and rejects updates that omit all KEY records.
This commit adds a new Nexus test case 1_3_SRP_TC_4 which implements
the test specification for SRP key lease handling.
The test verifies that:
- A service instance name cannot be claimed even after the service
instance lease has expired, as long as its key lease remains active.
- The SRP server correctly manages key leases and rejects registration
updates for hosts or services that are still claimed by a previous
registration during the key lease period.
- DNS and mDNS responses correctly reflect the state of registrations
and their expirations.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_4.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_4.py for pcap verification.
- Update tests/nexus/CMakeLists.txt to include the new test.
- Update tests/nexus/run_nexus_tests.sh to add it to DEFAULT_TESTS.
This commit removes the `Tlv::ReadTlvValue()` method which is no
longer needed or used. The same functionality is provided through
the `Tlv::Info` class, specifically using its `ParseFrom()` and
`ReadValue()` methods. This approach is safer and provides more
comprehensive information about the parsed TLV.
The unit tests are also updated to replace the usage of the removed
method with the new `Tlv::Info` based approach.
This commit introduces node-specific log files for Nexus tests. Each
created node can save its OpenThread logs into a separate file
`ot-logs<id>.log`.
The generation of log files is controlled by the environment variable
`OT_NEXUS_SAVE_LOGS`. By default, it is disabled, but it can be
activated by setting the environment variable to "1", "yes", "true",
"on", or "t".
This commit also refactors the Nexus platform logging logic into a new
`nexus_logging.cpp` file and improves the log message format in `stdout`
to include a standard timestamp using `UptimeToString()`.
This commit updates the `BBR_TC_3` Nexus test to use two separate host
nodes, `HOST_1` and `HOST_2`, for sending mDNS queries.
By using distinct host nodes, the packet verification script can now
unambiguously identify and track queries from different test steps
based on their source Ethernet MAC address. This improves the
robustness of the test by reducing reliance on packet sequence
numbers for isolation which can be fragile due to possible multiple
transmission of mDNS query message.
Specifically, `HOST_1` is used for queries in steps 1, 5, and 12,
while `HOST_2` is dedicated to the query in step 9. Both the C++ test
logic in `test_1_2_BBR_TC_3.cpp` and the Python verification script in
`verify_1_2_BBR_TC_3.py` are updated to reflect this change.
This commit provides the platform-level implementation for the
instance-aware logging API `otPlatLogOutput()`. This API is used when
`OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` is enabled, allowing
the platform to receive the `otInstance` pointer with each log line.
The new API is implemented across:
- The simulation platform logging.
- The POSIX platform using `syslog()`.
- The NCP base to route logs to the NCP host.
- The CLI logging module.
- Unit tests and mock platforms.
The `OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE` configuration is
also enabled for Toranj simulations to support multi-instance log
testing.
This commit adds a new Nexus test case 1_3_SRP_TC_3 which implements
the test specification for service instance lease renewal and
automatic service/host removal.
The test covers:
- SRP service registration and discovery via DNS and mDNS.
- SRP lease renewal before expiration.
- Automatic removal of SRP services and hosts after lease expiration.
- Verification of DNS and mDNS responses after lease expiration,
ensuring that expired records are no longer returned.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_3.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_3.py for pcap verification.
- Update tests/nexus/CMakeLists.txt to include the new test.
- Update tests/nexus/run_nexus_tests.sh to add it to DEFAULT_TESTS.
This commit adds a new Nexus test case 1_3_SRP_TC_2 which implements
the test specification for handling name conflicts in SRP host and
service registrations.
The test covers:
- Handling name conflicts in Host Description records.
- Handling name conflicts in Service Description records.
- Verifying that original services are discoverable on the AIL
while conflicting services are correctly rejected and not seen.
- Validating mDNS discovery on the adjacent infrastructure link
using direct method calls for SRP and DNS-SD operations.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_2.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_2.py for pcap verification.
- Update tests/nexus/CMakeLists.txt to include the new test.
- Update tests/nexus/run_nexus_tests.sh to add it to DEFAULT_TESTS.
This commit adds a new Nexus test case 1_3_SRP_TC_1 which verifies
SRP registration and discovery in a topology with a Border Router.
The test covers:
- SRP server registration in Thread Network Data.
- SRP service registration by a Thread End Device.
- Unicast DNS queries over the Thread interface.
- mDNS discovery over the Infrastructure interface.
Changes:
- Add tests/nexus/test_1_3_SRP_TC_1.cpp for test execution.
- Add tests/nexus/verify_1_3_SRP_TC_1.py for pcap verification.
- Update tests/nexus/CMakeLists.txt and run_nexus_tests.sh.
- Extend pktverify library (consts.py, layer_fields.py) to support
DNS/mDNS and SRP-specific fields.
This commit updates the `Mle` router role downgrade logic. When a
REED transitions to a router in response to a Child ID Request, it
indicates that the attaching child has no other viable parent options.
To ensure this child remains connected to the mesh, this commit
prevents the newly promoted router from downgrading back to a REED.
A new flag `mBlockDowngrade` is added to `Mle`, and a matching
property `mBlockParentDowngrade` is added to `Child` to track if it is
blocking its parent's downgrade. The downgrade restriction is lifted
under specific conditions: when the device detaches, when a new router
is added to the network (providing a potential alternative parent for
the child), or when all children blocking the downgrade are removed.
A new nexus test `test_mle_blocking_downgrade` is added to validate
the new behavior.
This commit removes the active node tracking logic from the Nexus
simulation framework.
Previously, `Core` maintained a pointer to the `mActiveNode` and updated
it dynamically during processing and network events. This was necessary
so that log messages could be attributed to the correct node/instance.
With the recent introduction of "instance-aware logging" in the OpenThread
core, the logging mechanism natively knows which `otInstance` generated a
log. Therefore, manually tracking and context-switching the active node
in the Nexus framework is no longer required.
This change simplifies `nexus::Core`, removes context-switching overhead
from heavily utilized inline methods like `Node::Get<Type>()`, and allows
us to simplify the signature of `InfraIf::Receive()`.
This commit adds a new Nexus test case 1_3_DBR_TC_10 which implements
the test specification for reachability, OMR address configuration,
and default route processing in a Thread network with a Border Router.
The test ensures that:
- End Devices correctly configure OMR addresses from OMR prefixes.
- Routers correctly process and route packets based on external
(default) routes advertised by Border Routers.
- Border Routers can manage default routes using both external route
TLVs (::/0) and the P_default flag in OMR prefixes.
Changes:
- Add tests/nexus/test_1_3_DBR_TC_10.cpp for test execution.
- Add tests/nexus/verify_1_3_DBR_TC_10.py for pcap verification.
- Update tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to include the new test.
This commit adds several new helper methods to tests/nexus/verify_utils.py
to simplify common verification tasks in Nexus tests:
- check_ra_has_rio: verify presence and preference of RIO in RA.
- check_ra_has_pio: verify presence of PIO in RA.
- check_nwd_has_route: verify presence and preference of external
route in Network Data.
Existing tests (1_3_DBR_TC_7A/B/C and 1_3_DBR_TC_8) are updated to use
these new helper methods, which improves code readability and
consistency across the Nexus test suite.
This commit introduces the 1_3_DBR_TC_8 Nexus test case, which
verifies bi-directional reachability in a topology with multiple
Border Routers (BRs) and the presence of OMR prefixes with different
lifetimes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures an OMR prefix (OMR_4, P_preferred=false) in Network
Data and ensures the DUT BR correctly generates its own OMR
prefix when existing ones are not usable.
- Verifies that the DUT BR correctly multicasts Router
Advertisements (RAs) on the infrastructure link containing OMR
routes but excluding deprecated OMR_4 routes.
- Confirms bi-directional ICMPv6 connectivity between an
infrastructure device and a Thread Router.
- Ensures the DUT BR continues to advertise OMR routes even after
the originating BR (BR_2) is disabled.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_8.cpp: Test execution logic using
direct method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_8.py: PCAP-based verification script
with robust Network Data and RA checking.
- Updates to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to register the new test case.
This commit introduces the 1_3_DBR_TC_7C Nexus test case, which
verifies bi-directional reachability in a topology with multiple
Border Routers (BRs) and the presence of non-OMR prefixes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures a non-OMR prefix (PRE_1, P_on_mesh=false) in Network
Data and ensures the DUT BR correctly generates its own OMR
prefix when existing ones are not usable.
- Verifies that the DUT BR correctly multicasts Router
Advertisements (RAs) on the infrastructure link containing OMR
routes but excluding PRE_1 routes.
- Confirms bi-directional ICMPv6 connectivity between an
infrastructure device and a Thread Router.
- Ensures the DUT BR continues to advertise OMR routes even after
the originating BR (BR_2) is disabled.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_7C.cpp: Test execution logic using
direct method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_7C.py: PCAP-based verification script
with robust Network Data and RA checking.
- Updates to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to register the new test case.
This commit adds `otPlatLogOutput()`, a new platform logging API that
provides the `otInstance` pointer along with a pre-formatted log
string. This addresses the limitation of the existing `otPlatLog()` in
multi-instance builds, where the function cannot reliably determine
which OpenThread instance generated the log.
`OPENTHREAD_CONFIG_LOG_INSTANCE_AWARE_API_ENABLE`, is introduced to
enable this behavior. When enabled, `Logger::Log()` resolves the
active instance (via a tracked global pointer `gActiveInstance`)
and passes it to `otPlatLogOutput()`.
To support tracking the active instance context,
`UpdateActiveInstance()` is added and called during standard
instance retrieval paths, such as `Locator::GetInstance()` and
`Message::GetInstance()`. The TCP endpoints and listeners are also
updated to track the active instance when their `GetInstance()` methods
are invoked.
The Nexus testing platform is updated to enable this configuration
and implement `otPlatLogOutput()` to print the instance ID alongside
the log line, simplifying log tracing in multi-node simulations.
This commit introduces the 1_3_DBR_TC_7B Nexus test case, which
verifies bi-directional reachability in a topology with multiple
Border Routers (BRs) and the presence of deprecated prefixes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures a deprecated prefix (PRE_1, P_preferred=false) in
Network Data and ensures the DUT BR correctly generates its own
OMR prefix when existing ones are not usable.
- Verifies that the DUT BR correctly multicasts Router Advertisements
(RAs) on the infrastructure link containing both OMR and PRE_1
routes.
- Confirms bi-directional ICMPv6 connectivity between an
infrastructure device and a Thread Router.
- Ensures the DUT BR continues to advertise PRE_1 routes even after
the originating BR (BR_2) is disabled, as long as the prefix
remains in Network Data.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_7B.cpp: Test execution logic using
direct method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_7B.py: PCAP-based verification script
with robust Network Data flag checking.
- Updates to tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh to register the new test case.
This commit introduces the 1_3_DBR_TC_7A Nexus test case, which verifies
bi-directional reachability in a topology with multiple Border Routers
(BRs) and the presence of non-OMR prefixes.
Key features of this test:
- Simulates a network with two BRs and a Thread Router.
- Configures an infrastructure link with a GUA prefix.
- Configures a non-OMR prefix (PRE_1) in Network Data and ensures the
DUT BR correctly generates its own OMR prefix when existing ones are
not usable (e.g., SLAAC disabled).
- Verifies that the DUT BR correctly multicasts Router Advertisements
(RAs) on the infrastructure link containing both OMR and PRE_1 routes.
- Confirms bi-directional ICMPv6 connectivity between an infrastructure
device and a Thread Router.
- Ensures the DUT BR continues to advertise PRE_1 routes even after the
originating BR (BR_2) is disabled, as long as the prefix remains in
Network Data.
The implementation includes:
- tests/nexus/test_1_3_DBR_TC_7A.cpp: Test execution logic using direct
method calls and Note-level logging.
- tests/nexus/verify_1_3_DBR_TC_7A.py: PCAP-based verification script
with robust Network Data flag checking.
- Updates to tests/nexus/CMakeLists.txt and tests/nexus/run_nexus_tests.sh
to register the new test case.
In order to facilitate a well-staged post reset process for a larger
size link, it is important to consider the timing of devices returning
to the link.
With the changes in this PR, that timing will be as follows:
1. The leader and routers will begin sending link request messages in
an attempt to reattach to the previous partition.
2. Both the leader and routers will have 4 attempts to reconnect,
afterwords falling back to attach any.
3. The leader here is given a 2s retry window (jittered 10% either
way), for a worst-case (tightest timing vs routers) of 4x2.2s =
8.8s before starting attachment.
4. The routers here are given the normal 5s multicast retx delay with
the same 10% jitter, resulting in a tightest timing (shortest) of
4x4.5s = 18s
5. For this analysis, the jitter during the attach process is ignored
because it will not be particularly significant, so we assume both
flow through a nominal failed attachment of 2x0.75s (routers) +
4x1.25s (reeds) = 6.5s
6. This means that the previous leader will start the new partition
around 15.3s after starting.
7. The former routers would fall back to starting a new partition on
their own at 24.5s after reset.
This timing leaves 9.2s of leeway (greater than the length of the full
attachment process) for the routers to get parent responses from the
old leader which has started the new partition and attach instead of
starting their own partitions.
This also leaves sufficient time between the router attachment and
children timing out of their role restoration process to attach to
their former parents.
Additionally, 4 attempts should be more than sufficient with this
timing to successfully reattach to a partition that did not also
reset. If a link request sent in this period is not accepted, then the
old partition can be safely assumed to be gone, or removed links to
the reset device.
Routers with children and the leader will also benefit in
single-device reset cases here because they are able to rejoin more
quickly. Only routers with very few/no children are slowed down in
re-attachment by 5s.
This commit introduces the 1_3_DBR_TC_6 Nexus test case to verify
bi-directional reachability in a multi-BR topology with existing
IPv6 infrastructure.
Key changes:
- Implement tests/nexus/test_1_3_DBR_TC_6.cpp and its corresponding
pcap-based verification script tests/nexus/verify_1_3_DBR_TC_6.py.
- Enhance the Nexus platform InfraIf class to support constructing
and sending ICMPv6 Router Advertisements (RA) with PIO and RIO.
- Add RouterAdvertisementStart() and RouterAdvertisementStop() to
InfraIf for managed periodic unsolicited RA transmissions.
- Update Core::Process() to drive the periodic RA logic in InfraIf.
- Implement response logic for ICMPv6 Router Solicitations in
InfraIf when RA advertising is enabled.
- The 1_3_DBR_TC_6 test validates that the DUT BR correctly adopts
existing OMR prefixes, advertises an external default route (::/0),
and sends appropriate RAs on the infrastructure link.
- Register the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit adds `CloneMessage()`, `CloneMessageWithoutFooter()`,
and `CloneMessageWithout<Footer>()` methods to the `MessageAllocator`
class. These methods simplify creating copies of messages by
automatically applying the correct `kReservedHeader` size. It also
updates existing code in `CoapBase`, `Dns::Client`, `Sntp::Client`,
and `Mle` to utilize these new methods.
Additionally, this commit updates the `Clone()` method in `Message`
to be a template method, accepting a `CloneMode` to specify whether
the cloned message should retain the reserved header or have no
reserved header. The documentation for the clone methods has also
been updated to clarify which message fields are copied during the
cloning process.
This commit introduces the 1_3_DBR_TC_3 nexus test case to verify
bi-directional reachability between multiple Thread networks connected
via a common infrastructure link.
The test verifies that independent Thread networks, each with its own
Border Router (BR) connected to the same infrastructure link, can
successfully route traffic to each other. This confirms reachability
in multi-Thread network environments where no existing IPv6
infrastructure is present.
Key changes:
- Implement test_1_3_DBR_TC_3.cpp to simulate a topology with two
Thread networks (BR_1/ED_1 and BR_2/ED_2) and verify end-to-end
ping success between End Devices.
- Implement verify_1_3_DBR_TC_3.py for pcap-based validation of:
- Network Data registration of OMR and infrastructure prefixes.
- RA multicasts on the infrastructure link with correct RIO/PIO.
- Proper mapping of Extended PAN ID into the infrastructure ULA.
- Bi-directional ICMPv6 connectivity between End Devices.
- Register the new test case in CMakeLists.txt and run_nexus_tests.sh.
Thread spec doesn't define the order of TLVs in the dataset, so that
we can't call `memcmp` to compare two dataset. If we convert the
dataset to otOperationalDataset and then compare each value of
otOperationalDataset, we will met an issue if the new Thread spec
defines new TLVs in the dataset in the future.
This commit add a new dataset API `otDatasetTlvsCompare` to check
whether two dataset contain the exact same set of TLVs (same types and
values).
This commit refactors the verification logic for Distributed Border
Router (DBR) tests in the Nexus framework to enhance robustness and
reliability.
Key changes include:
- Introduced verify_utils.check_nwd_prefix_flags() to handle complex
Thread Network Data structures, allowing for precise verification of
Prefix TLV flags and Border Router sub-TLV flags even when multiple
prefixes are present.
- Updated verify_1_3_DBR_TC_1.py and verify_1_3_DBR_TC_2.py to use
the new helper and improved the identification of OMR and ULA
prefixes in Network Data by iterating through TLV types.
- Added verification for Preferred and Valid Lifetimes in ICMPv6 Prefix
Information Options (PIO) within Router Advertisements.
- Enhanced pktverify to support icmpv6.opt.pio_valid_lifetime and
ensured proper mapping of PIO lifetime fields.
- Simplified MLE Data Response filtering in verify_1_3_DBR_TC_1.py
for better maintainability.
This commit introduces the 1_3_DBR_TC_2 nexus test case to verify
bi-directional reachability between Thread and infrastructure devices
in a topology with multiple Border Routers.
Key changes:
- Implement test_1_3_DBR_TC_2.cpp for step-by-step execution logic.
- Implement verify_1_3_DBR_TC_2.py for pcap-based verification.
- Enable OPENTHREAD_CONFIG_BORDER_ROUTING_TESTING_API_ENABLE in nexus
platform configuration to support prefix manipulation.
- Add icmpv6.opt.pio_preferred_lifetime to pktverify layer fields.
- Register the new test case in CMakeLists.txt and the default nexus
test run script.
- Refactor verify_1_3_DBR_TC_1.py and verify_1_3_DBR_TC_2.py to move
nested helper functions to the top level for better modularity.
- Remove an unnecessary Deinit() call in test_1_3_DBR_TC_1.cpp and
its definition in nexus_infra_if.hpp.
The test verifies:
- Border Router adoption of existing OMR prefixes in the network.
- Router Advertisement (RA) behavior on the infrastructure link,
including correct RIO options and suppression of non-deprecating PIOs
when another BR is present.
- Bi-directional reachability between Thread End Devices and Adjacent
Infrastructure Link (AIL) hosts during BR transitions.
- Automatic election of a new Leader and promotion to Primary BR upon
loss of the previous Leader.
- Correct derivation of BR ULA prefixes from the Extended PAN ID.
Nexus test 1_2_BBR_TC_3 occasionally fails during Step 6 after a
device reboot. The failure occurs because the Backbone Router (BBR)
is reported as active in the mDNS state bitmap ('sb' record), but
the mandatory 'omr' record is not yet present in the response.
This transient state happens because the BBR function is enabled
immediately upon attachment, whereas the Routing Manager requires
a brief period to establish and favor an OMR prefix.
This commit updates the Python verification script to filter for
mDNS responses that include the 'omr' record in Steps 6 and 13. This
allows the test to wait for the complete state to be published
naturally, rather than failing on the first transient packet
received.
Validated with 50 successful sequential executions of the test.
This commit implements the 1_3_DBR_TC_1 nexus test case to verify
bi-directional reachability between Thread and infrastructure
devices with a single Border Router.
Key changes:
- Implement test_1_3_DBR_TC_1.cpp for step-by-step execution logic.
- Implement verify_1_3_DBR_TC_1.py for pcap-based verification.
- Enhance Nexus InfraIf platform to support Deinit() for AIL
disconnection.
- Update InfraIf::Receive() to check initialization status and
ignore kErrorDrop from SendRaw() to handle legitimate packet
drops in the stack.
- Register the new test case in CMakeLists.txt and the default
nexus test run script.
The test verifies:
- Automatic OMR and on-link prefix registration in Network Data.
- Periodic ND Router Advertisement multicast on the infrastructure
link with correct PIO/RIO options and Extended PAN ID derivation.
- Bi-directional reachability between Thread End Devices (OMR) and
Infrastructure Hosts (ULA).
- Strict enforcement of non-forwarding rules for link-local and
Mesh-Local EID traffic between the Thread and infrastructure
networks.
Nexus test 1_2_BBR_TC_2 was occasionally failing at Step 14.
In this step, the previous leader (Router_1) is disabled, and
the DUT (BR_1) is expected to become the new leader and the
Primary Backbone Router (BBR).
The original wait time was 200 seconds (kAttachToRouterTime).
However, analysis showed that routers wait for the MLE Router
ID Timeout (120 seconds) before initiating a new leader election.
Combined with election jitter and BBR registration time, this
sometimes exceeded the 200-second window.
This commit increases the wait time in Step 14 to 400 seconds
(kAttachToRouterTime * 2) to provide sufficient buffer for the
leader transition and BBR registration, effectively resolving
the flake.
This commit implements the BBR-TC-03 test case in the Nexus simulation
framework to verify that a Backbone Router (BBR) function can be
discovered using mDNS and that changes are correctly reflected.
Key implementation details include:
- Implementation of BBR-TC-03 in C++ simulating a topology with two
Border Routers (BR_1 as initial Primary BBR, BR_2 as Secondary)
and a non-Thread IPv6 Host used for mDNS queries.
- Use of direct method calls instead of OpenThread public APIs where
appropriate, following Nexus test conventions.
- Configuration of the test environment including fixed Operational
Datasets to ensure predictable verification.
- Simulation of various network states:
- Initial Primary/Secondary BBR discovery.
- BBR function persistence after device reboot.
- Role transition (Secondary becoming Primary) when the original
Primary BBR powers down.
- Secondary BBR discovery when the original Primary BBR rejoins.
- Addition of a Python verification script to validate mDNS packets on
the simulated infrastructure link, checking for:
- Correct mDNS query/response exchanges between Host and BBRs.
- Presence and format of mandatory TXT records (dn, bb, sq, rv, tv,
sb, nn, xp, omr).
- Proper state bitmap (sb) transitions reflecting Primary vs.
Secondary status.
- Inclusion of the full test specification as inline comments in both
C++ and Python files, adhering to strict formatting requirements.
- Registration of the new test case in tests/nexus/CMakeLists.txt and
the default test list in tests/nexus/run_nexus_tests.sh.
- Setting log level to 'note' for improved visibility into state
transitions.
Update mDNS traffic simulation in the Nexus platform to flow through
the simulated infrastructure link. This ensures mDNS packets are
automatically written to the PCAP file generated by the simulated
infrastructure link.
Changes:
- Wrap mDNS messages in UDP/IPv6 headers and enqueue them on the
simulated infrastructure interface (InfraIf).
- Implement a new SendUdp overload in InfraIf that accepts a Message
payload.
- Update InfraIf::Receive to intercept mDNS UDP packets (port 5353)
and deliver them to the Mdns module.
- Remove the dedicated ProcessMdns loop and manual PendingTx list from
Core and Mdns, consolidating traffic processing through InfraIf.
- Initialize Mdns with a reference to the Node to allow access to
InfraIf.
- Add GetMulticastAddress static helper to Mdns for 'ff02::fb'.
This commit implements the BBR-TC-02 test case in the Nexus simulation
framework to verify that if two BBR Datasets are present in a network,
the Backbone Router (BBR) that is not elected as Primary will delete
its own BBR Dataset from the Network Data.
Key implementation details include:
- Implementation of BBR-TC-02 in C++ simulating a topology with two
Border Routers (BR_1 as DUT/initial Primary, BR_2) and a Thread
Router as Leader.
- Verification of BR_1's role switch from Primary to Secondary when it
detects a BBR Dataset with a higher sequence number (BR_2's dataset).
- Verification that BR_1 sends a Server Data notification to the Leader
to remove its BBR Dataset upon switching to the Secondary role.
- Verification that BR_1 (as Secondary BBR) correctly rejects MLR.req
messages with ST_MLR_BBR_NOT_PRIMARY.
- Verification that BR_1 automatically resumes the Primary BBR role
and becomes Leader when Router_1 and BR_2 are removed from the
network.
- Addition of a Python verification script to validate:
- Correct sequence of SVR_DATA.ntf CoAP requests for BBR Dataset
registration and removal.
- Correct handling of MLR.req with ST_MLR_BBR_NOT_PRIMARY error.
- Correct filtering of Thread Network Data TLVs in CoAP payloads.
- Inclusion of the full test specification as inline comments in both
the C++ and Python files.
- Use of direct core method calls in C++ and adherence to strict
formatting rules in both files.
- Registration of the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit implements the BBR-TC-01 test case in the Nexus simulation
framework to verify that a Backbone Router (BBR) device automatically
sends its BBR dataset to the Leader if none exists in the network.
To support the Host receiving echo replies on its infrastructure
interface, the Nexus InfraIf class is extended to support custom
ICMPv6 Echo Reply handlers.
Key changes:
- Implement BBR-TC-01 C++ test case and Python verification script.
- Add EchoReplyHandler callback and registration to Nexus InfraIf.
- Update InfraIf::Receive to handle and dispatch ICMPv6 Echo Replies.
- Register 1_2_BBR_TC_1 in CMake and the test runner script.
This commit adds a new nexus test for MATN-TC-26: Multicast
registrations error handling by Thread Device.
The test verifies that a Thread Device correctly handles multicast
registration errors, such as when a Backbone Router (BBR) runs out of
resources or responds with a general failure.
Changes:
- Implemented test_1_2_MATN_TC_26.cpp to execute the test steps.
- Implemented verify_1_2_MATN_TC_26.py to verify pcap output.
- Updated CMakeLists.txt and run_nexus_tests.sh to include the
new test.
- Modified bbr_manager.cpp to correctly include failed addresses in
the MLR response when using configured error status for reference
devices.
The test ensures the DUT retries registration within the
Reregistration Delay after receiving an error and does not retry
if registration was successful until necessary.
This commit adds a new Nexus test case MATN-TC-23 to verify that a
Thread Device (DUT) automatically re-registers its multicast addresses
before the Multicast Listener Registration (MLR) timeout expires.
The test simulates a topology with two Border Routers (BR_1 and BR_2)
and a Thread Device (TD as DUT). BR_1 acts as the Primary Backbone
Router (BBR) and distributes a BBR Dataset with a configured MLR
timeout. The TD registers a multicast address and then automatically
sends a subsequent MLR.req to renew the registration before the
timeout period ends.
Implementation details:
- Added test_1_2_MATN_TC_23.cpp to execute the simulation using direct
method calls and 'note' log level.
- Added verify_1_2_MATN_TC_23.py to validate the MLR.req/rsp exchange
in the pcap output.
- Included the full test specification as inline comments in both
files, following strict indentation and formatting rules.
- Registered the new test in CMakeLists.txt and run_nexus_tests.sh.
This commit adds a new Nexus test case MATN-TC-22 to verify that a
Primary Backbone Border Router (BBR) that is configured with a low
value of Multicast Listener Registration (MLR) timeout
(< MLR_TIMEOUT_MIN) is interpreted as using an MLR timeout of
MLR_TIMEOUT_MIN by Thread Devices (DUT).
The test performs the following steps:
- Configures the Primary BBR (BR_1) with an MLR timeout of
MLR_TIMEOUT_MIN / 4.
- Verifies that the DUT registers a multicast address (MA1) at BR_1.
- Confirms that the DUT automatically re-registers for MA1 within
MLR_TIMEOUT_MIN seconds of the initial registration.
- Ensures that no more than 2 re-registrations occur within this time
period.
Included changes:
- New test implementation: test_1_2_MATN_TC_22.cpp.
- New verification script: verify_1_2_MATN_TC_22.py.
- Registration of the test in CMakeLists.txt and run_nexus_tests.sh.
The test implementation uses direct method calls in C++ and provides
step-by-step logging in both C++ and Python to match the test
specification.
This commit implements the MATN-TC-21 test case in the Nexus
simulation framework to verify that a Primary BBR correctly handles
incorrect or invalid multicast registrations from a Thread device.
Key implementation details include:
- Implementation of MATN-TC-21 in C++ simulating a topology with two
Border Routers (BR_1 as Primary/DUT, BR_2 as Secondary), a Thread
Router, and a Host.
- Verification of BR_1's handling of various invalid MLR registrations:
- Invalid unicast addresses (MAe1, MAe3) or unspecified address (MAe2).
- Link-local (MA6) and mesh-local (MA5) multicast addresses.
- Partial registration success when valid (MA1) and invalid (MA6)
addresses are mixed.
- Malformed IPv6 Addresses TLV with incorrect length (MAe4).
- Verification that only the Primary BBR (BR_1) accepts registrations,
while the Secondary BBR (BR_2) returns ST_MLR_BBR_NOT_PRIMARY.
- Addition of a Python verification script to validate:
- Correct error status codes in MLR responses (ST_MLR_INVALID,
ST_MLR_BBR_NOT_PRIMARY).
- Multicast forwarding from backbone to Thread for valid registrations.
- Handling of malformed TLVs by checking raw CoAP payloads.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-20 test case in the Nexus
simulation framework to verify that a Parent Router handling a
multicast registration on behalf of an MTD re-registers the
multicast address on behalf of its child before the MLR timeout
expires.
Key implementation details include:
- Implementation of the MATN-TC-20 test scenario in C++ simulating
a topology with a Router (DUT), a MED, and two Border Routers
(BR_1 as initial Primary BBR, BR_2 as Secondary BBR).
- Addition of a Python verification script to validate MLE Child
Update Request/Response exchanges and subsequent MLR.req CoAP
requests from the DUT to the Primary BBR.
- Verification that the DUT automatically re-registers the multicast
address when the MLR timeout is updated in the BBR Dataset.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files, following strict formatting rules.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit introduces the `OPENTHREAD_CONFIG_IP6_INIT_EXT_ADDR_POOL_ENABLE`
configuration and the `otIp6Init()` API. When enabled, this feature
allows the OpenThread stack to use externally provided memory buffers for
its external unicast and multicast address pools.
By decoupling the pool sizes from build-time configurations
(`OPENTHREAD_CONFIG_IP6_MAX_EXT_UCAST_ADDRS` and
`OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS`), the OpenThread stack can be
compiled as a generic library without hardcoding the address pool sizes.
It delegates the memory allocation and configuration to the application
layer at run-time.
When the feature is enabled, `otIp6Init()` must be invoked to initialize
the `Netif` address pools before calling `otIp6SetEnabled()`.
This commit introduces the `MessageAllocator` template class using the
CRTP pattern to provide a unified implementation of the `NewMessage()`
methods. It standardizes the reserved header sizes for different
message types within `ReservedHeaderSize`. This removes boilerplate
code and redundant `NewMessage()` method implementations across the
`Ip6`, `Icmp`, `Udp`, `Udp::Socket`, and `CoapBase` classes.
This commit implements the Thread 1.2 test MATN-TC-19: Multicast
registration by MTD in the Nexus simulation framework. The test
verifies that an MTD can correctly register multicast addresses
through a parent Thread Router and receive multicast traffic from
the backbone.
Key implementation details:
- Created test_1_2_MATN_TC_19.cpp to simulate the network topology
(BR_1, BR_2, Router, MTD, and Host) and execute the test steps
using direct method calls.
- Implemented verify_1_2_MATN_TC_19.py for PCAP-based verification
of MLE Child Update exchanges, MLR registrations, and multicast
ICMPv6 Echo Request/Reply forwarding.
- Configured the test to use Note log level and included 1-line
log output for each step to match existing Nexus tests.
- Integrated the new test into the Nexus build system via
CMakeLists.txt and added it to the default test execution list
in run_nexus_tests.sh.
This commit adds a new Nexus test case MATN-TC-16 to verify that the
Primary Backbone Border Router (BBR) can handle a large number of
multicast group subscriptions.
The test performs 75 multicast registrations in 5 batches of 15
addresses each. It verifies the following behavior:
- The BBR correctly processes Multicast Listener Registration (MLR)
requests and returns a success status.
- Multicast packets sent to registered addresses on the backbone are
successfully forwarded to the Thread network.
- Multicast packets sent to unregistered addresses are not forwarded.
To accommodate the requirements of this test, Nexus configuration
limits are increased:
- OPENTHREAD_CONFIG_IP6_MAX_EXT_MCAST_ADDRS is increased from 4 to 80.
- The mTestVars array in Nexus Core is increased from 16 to 128
entries to support storing all multicast addresses for verification.
Included changes:
- New test files: test_1_2_MATN_TC_16.cpp and verify_1_2_MATN_TC_16.py.
- Registration of the test in CMakeLists.txt and run_nexus_tests.sh.
- Configuration updates in openthread-core-nexus-config.h and
nexus_core.hpp.
This commit implements the MATN-TC-15 test case in the Nexus simulation
framework to verify that a Thread End Device detects a change of Primary
Backbone Router (BBR) and triggers a re-registration of its multicast
groups.
Key implementation details include:
- Implementation of MATN-TC-15 in C++ simulating a topology with two
Border Routers (BR_1 and BR_2), a Thread Router, and a Thread End
Device (TD as DUT).
- Simulation of Primary BBR failover by stopping BR_1 and waiting for
BR_2 to become the new Primary BBR.
- Addition of a Python verification script to validate:
- Detection of Primary BBR change by the DUT.
- Multicast Listener Registration (MLR.req) sent by the DUT to BR_2.
- Correct forwarding of MLR.req and MLR.rsp by the intermediate
Thread Router.
- Successful registration response (MLR.rsp) from BR_2 to the DUT.
- Inclusion of the full test specification as inline comments in both
the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt and
tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-12 test case in the Nexus
simulation framework to verify that a Primary BBR correctly
decrements the IPv6 Hop Limit when forwarding multicast packets
between the backbone link and the Thread network.
Key implementation details include:
- Implementation of MATN-TC-12 in C++ simulating a topology with a
Border Router (BR_1 as DUT), a Thread Router, and a Host.
- Enhancement of the Nexus platform to support hop limit processing:
- Updated InfraIf::Receive to decrement Hop Limit when forwarding
from the backbone to the Thread network.
- Updated Node::HandleReceive to decrement Hop Limit when forwarding
from the Thread network to the backbone.
- Added support for simulating packets with Hop Limit 0 by setting
mAllowZeroHopLimit in Node::SendEchoRequest.
- Addition of a Python verification script to validate:
- Multicast forwarding from backbone to Thread with decrement.
- Multicast forwarding from Thread to backbone with decrement.
- Dropping of packets with Hop Limit 1 (or 0) during forwarding.
- Use of unique ICMPv6 identifiers to reliably distinguish between
pings in different test steps.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-10 test case in the Nexus
simulation framework to verify that a Secondary BBR correctly
takes over forwarding of outbound multicast transmissions when
the Primary BBR fails, specifically focusing on BBR Dataset
distribution and MLDv2/BMLR registration behavior.
Key implementation details include:
- Implementation of the MATN-TC-10 test scenario in C++ simulating
a topology with two Border Routers (BR_1 as initial Primary,
BR_2 as Secondary/DUT), a Router, and a Host.
- Verification that BR_2 takes over as the Primary BBR and Leader
after BR_1 is stopped.
- Validation of BBR Dataset (PBBR) presence in Network Data.
- Addition of a Python verification script to validate:
- Multicast ping reachability.
- Correct BBR Dataset distribution.
- Outbound multicast registration (BMLR/MLDv2) on the backbone.
- Use of explicit multicast re-subscription in Step 14 to ensure
observable registration traffic within the simulation window.
- Robust packet filters for BMLR (port 61631) and MLDv2 to handle
platform-specific dissection variances.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-09 test case in the Nexus
simulation framework to verify that a Secondary BBR correctly
takes over forwarding of outbound multicast transmissions when
the Primary BBR fails.
Key implementation details include:
- Implementation of the MATN-TC-09 test scenario in C++ simulating
a topology with two Border Routers (BR_1 as initial Primary,
BR_2 as Secondary/DUT) and a Thread Router.
- Verification that BR_2 takes over as the Primary BBR and Leader
after BR_1 is stopped.
- Addition of a Python verification script to validate that only
the Primary BBR forwards outbound multicast packets to the
backbone link.
- Use of distinct ICMPv6 identifiers to reliably distinguish
between multicast pings sent before and after the Primary BBR
failure.
- Inclusion of the full test specification as inline comments in
both the C++ and Python files.
- Registration of the new test case in tests/nexus/CMakeLists.txt
and tests/nexus/run_nexus_tests.sh.
This commit implements the MATN-TC-07 test case in the Nexus
simulation framework to verify default multicast forwarding
behavior on Border Routers.
Key implementation details include:
- Implementation of the MATN-TC-07 test scenario in C++ to
trigger various multicast ping requests across different
IPv6 scopes (realm-local, admin-local, site-local, global,
and link-local).
- Enhancement of the Python verification script to strictly
validate that only the Primary BBR forwards multicast
packets to the backbone link using Ethernet source address
filtering.
- Support for Ethernet link type in Nexus PCAP generation by
prepending Ethernet headers to infrastructure IPv6 packets.
- Exposure of infrastructure MAC addresses (ethaddrs) in the
test information JSON to enable identification of the
forwarding node on the backbone link.
- Support for verifying source addresses of MPL-encapsulated
multicast packets by checking both outer and inner headers.
- Addition of FindGlobalAddress() helper in the Nexus node
platform.
Implement Thread 1.2 test MATN-TC-05: Re-registration to same Multicast
Group. This test verifies that a Primary Backbone Router (BBR)
correctly manages multicast address re-registration and handles UDP
multicast traffic between the backbone and Thread network.
Key additions:
- Added SendUdp to Nexus InfraIf to support simulated UDP multicast
traffic from backbone hosts.
- Implemented test_1_2_MATN_TC_5.cpp to simulate the network topology
(DUT, BR_2, Router, and Host) and the test steps.
- Implemented verify_1_2_MATN_TC_5.py for pcap-based verification of
multicast forwarding and BBR timeout behavior.
- Integrated the new test into the Nexus build system and the default
test execution script.