From 49582b3d9fb5fb9dfafc20f2f5e27060ca17121d Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Wed, 4 Mar 2026 12:04:56 -0600 Subject: [PATCH] [nexus] refactor test 1.2.LP.5.3.1 and remove kAsSsed mode (#12615) This commit refactors Nexus test 1.2.LP.5.3.1 to better align with the specification and improves the robustness of the test logic and verification script. It also removes the kAsSsed join mode to favor explicit CSL configuration in tests. Changes: - Removed kAsSsed from Nexus::Node::JoinMode and Node::Join() to encourage tests to manage CSL parameters explicitly. - Updated test_1_2_LP_5_3_1.cpp to join as a regular SED first and enable CSL after attachment. This matches the specification's requirement to establish synchronization via Child Update Request. - Introduced constants in test_1_2_LP_5_3_1.cpp for CSL period, synchronization time, and other parameters to avoid magic numbers. - Enhanced verify_1_2_LP_5_3_1.py with comprehensive checks for: - MLE Child Update Request/Response exchange. - IEEE 802.15.4-2015 frame versions. - ICMPv6 Echo Request/Response forwarding through the Leader. - Absence of MAC Data Requests after CSL synchronization. - Fixed an issue in verify_1_2_LP_5_3_1.py where packet numbers were not correctly handled in pkts.range(). --- tests/nexus/platform/nexus_node.cpp | 9 --------- tests/nexus/platform/nexus_node.hpp | 1 - tests/nexus/test_1_2_LP_5_3_1.cpp | 25 ++++++++++++++++++++++--- tests/nexus/verify_1_2_LP_5_3_1.py | 23 ++++++++++++++++++----- 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/tests/nexus/platform/nexus_node.cpp b/tests/nexus/platform/nexus_node.cpp index de048d2bb..c2bc0d1de 100644 --- a/tests/nexus/platform/nexus_node.cpp +++ b/tests/nexus/platform/nexus_node.cpp @@ -87,15 +87,6 @@ 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().SetCslPeriod(kDefaultCslPeriod); - Get().SetCslTimeout(kDefaultCslTimeout); - break; - } } SuccessOrQuit(Get().SetDeviceMode(Mle::DeviceMode(mode))); diff --git a/tests/nexus/platform/nexus_node.hpp b/tests/nexus/platform/nexus_node.hpp index 6aaa9a2aa..95cfc3ba9 100644 --- a/tests/nexus/platform/nexus_node.hpp +++ b/tests/nexus/platform/nexus_node.hpp @@ -79,7 +79,6 @@ public: kAsFed, kAsMed, kAsSed, - kAsSsed, kAsSedWithFullNetData, }; diff --git a/tests/nexus/test_1_2_LP_5_3_1.cpp b/tests/nexus/test_1_2_LP_5_3_1.cpp index abd6b32a2..4edcb1a8d 100644 --- a/tests/nexus/test_1_2_LP_5_3_1.cpp +++ b/tests/nexus/test_1_2_LP_5_3_1.cpp @@ -49,6 +49,21 @@ static constexpr uint32_t kAttachToRouterTime = 200 * 1000; */ static constexpr uint32_t kAttachAsSsedTime = 20 * 1000; +/** + * CSL Period in milliseconds. + */ +static constexpr uint32_t kCslPeriodMs = 100; + +/** + * CSL Period in units of 10 symbols. + */ +static constexpr uint32_t kCslPeriod = kCslPeriodMs * 1000 / OT_US_PER_TEN_SYMBOLS; + +/** + * Time to advance for CSL synchronization to complete, in milliseconds. + */ +static constexpr uint32_t kCslSyncTime = 5 * 1000; + /** * Payload size for a standard ICMPv6 Echo Request. */ @@ -121,7 +136,11 @@ void Test1_2_LP_5_3_1(void) * - Pass Criteria: N/A. */ - ssed1.Join(leader, Node::kAsSsed); + ssed1.Join(leader, Node::kAsSed); + nexus.AdvanceTime(kAttachAsSsedTime); + VerifyOrQuit(ssed1.Get().IsAttached()); + + ssed1.Get().SetCslPeriod(kCslPeriod); Log("---------------------------------------------------------------------------------------"); Log("Step 3: Leader (DUT)"); @@ -134,8 +153,8 @@ void Test1_2_LP_5_3_1(void) * - The Frame Version of the packet MUST be: IEEE Std 802.15.4-2015 (value = 0b10). */ - nexus.AdvanceTime(kAttachAsSsedTime); - VerifyOrQuit(ssed1.Get().IsAttached()); + nexus.AdvanceTime(kCslSyncTime); + VerifyOrQuit(ssed1.Get().IsCslEnabled()); Log("---------------------------------------------------------------------------------------"); Log("Step 4: Router_1"); diff --git a/tests/nexus/verify_1_2_LP_5_3_1.py b/tests/nexus/verify_1_2_LP_5_3_1.py index e00e6be3e..2bc02a50f 100644 --- a/tests/nexus/verify_1_2_LP_5_3_1.py +++ b/tests/nexus/verify_1_2_LP_5_3_1.py @@ -61,6 +61,7 @@ def verify(pv): LEADER = pv.vars['LEADER'] LEADER_RLOC16 = pv.vars['LEADER_RLOC16'] ROUTER_1 = pv.vars['ROUTER_1'] + ROUTER_1_RLOC16 = pv.vars['ROUTER_1_RLOC16'] SSED_1 = pv.vars['SSED_1'] SSED_1_RLOC16 = pv.vars['SSED_1_RLOC16'] @@ -89,10 +90,10 @@ def verify(pv): # - 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).\ + _response_pkt = 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).\ + filter(lambda p: p.wpan.version == consts.MAC_FRAME_VERSION_2015).\ must_next() # Step 4: Router_1 @@ -105,26 +106,38 @@ def verify(pv): # - Router_1 MUST receive an ICMPv6 Echo Response from SSED_1. print("Step 4: Router_1 sends Echo Request to SSED_1") + # Echo Request from ROUTER_1 to LEADER + pkts.filter_ping_request().\ + filter_wpan_src64(ROUTER_1).\ + filter_wpan_dst16(LEADER_RLOC16).\ + must_next() + # 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).\ + filter(lambda p: p.wpan.version == consts.MAC_FRAME_VERSION_2015).\ 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)).\ + pkts.range((_response_pkt.number, _response_pkt.number), (_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 + # Echo Response from SSED_1 to LEADER pkts.filter_ping_reply(identifier=_pkt.icmpv6.echo.identifier).\ filter_wpan_src64(SSED_1).\ filter_wpan_dst16(LEADER_RLOC16).\ must_next() + # Forwarded Echo Response from LEADER to ROUTER_1 + pkts.filter_ping_reply(identifier=_pkt.icmpv6.echo.identifier).\ + filter_wpan_src64(LEADER).\ + filter_wpan_dst16(ROUTER_1_RLOC16).\ + must_next() + if __name__ == '__main__': verify_utils.run_main(verify)