mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[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().
This commit is contained in:
@@ -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<Mac::Mac>().SetCslPeriod(kDefaultCslPeriod);
|
||||
Get<Mle::Mle>().SetCslTimeout(kDefaultCslTimeout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SuccessOrQuit(Get<Mle::Mle>().SetDeviceMode(Mle::DeviceMode(mode)));
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
kAsFed,
|
||||
kAsMed,
|
||||
kAsSed,
|
||||
kAsSsed,
|
||||
kAsSedWithFullNetData,
|
||||
};
|
||||
|
||||
|
||||
@@ -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<Mle::Mle>().IsAttached());
|
||||
|
||||
ssed1.Get<Mac::Mac>().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<Mle::Mle>().IsAttached());
|
||||
nexus.AdvanceTime(kCslSyncTime);
|
||||
VerifyOrQuit(ssed1.Get<Mac::Mac>().IsCslEnabled());
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 4: Router_1");
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user