[nexus] fix and stabilize test 9.2.7 (#12553)

This commit fixes and stabilizes Nexus test case 9.2.7. It ensures full
compliance with the test specification and improves resilience against
timing variations in the simulated environment.

Changes:
- tests/nexus/test_9_2_7.cpp: Corrected the node sending the pending
  dataset update in Step 11 to the Router, matching the spec. Ensured the
  full Pending Operational Dataset is included in the request. Fixed
  misleading comments regarding timestamp values and ensured Step 11 uses
  a strictly higher active timestamp than Step 5.
- tests/nexus/verify_9_2_7.py: Relaxed delay timer verification slack to
  improve test stability. Added explicit checks for Active and Pending
  Timestamps in multicast MLE Data Responses. Corrected expected timestamp
  values and comments.
This commit is contained in:
Jonathan Hui
2026-02-25 19:49:49 -06:00
committed by GitHub
parent b354c62821
commit 2202fae8a9
2 changed files with 30 additions and 32 deletions
+23 -29
View File
@@ -323,7 +323,7 @@ void Test9_2_7(void)
* - Leader Data TLV
* - Data Version field incremented
* - Stable Version field incremented
* - Active Timestamp TLV: 15s
* - Active Timestamp TLV: 20s
* - Network Data TLV:
* - Commissioner Data TLV:
* - Stable flag set to 0
@@ -382,11 +382,11 @@ void Test9_2_7(void)
nexus.AdvanceTime(kResponseTime);
Log("---------------------------------------------------------------------------------------");
Log("Step 11: Commissioner");
Log("Step 11: Router");
/**
* Step 11: Commissioner
* - Description: Harness instructs the Commissioner to send a MGMT_PENDING_SET.req to the DUTs Anycast or Routing
* Step 11: Router
* - Description: Harness instructs the Router to send a MGMT_PENDING_SET.req to the DUTs Anycast or Routing
* Locator:
* - CoAP Request URI: coap://[<L>]:MM/c/ps
* - CoAP Payload: < Commissioner Session ID TLV not present>, Pending Timestamp TLV: 30s, Active Timestamp TLV:
@@ -395,28 +395,29 @@ void Test9_2_7(void)
*/
{
Tmf::Agent &agent = commissioner.Get<Tmf::Agent>();
Coap::Message *message = agent.NewPriorityConfirmablePostMessage(ot::kUriPendingSet);
Tmf::Agent &agent = router.Get<Tmf::Agent>();
Coap::Message *message;
MeshCoP::Dataset dataset;
MeshCoP::Timestamp timestamp;
message = agent.NewPriorityConfirmablePostMessage(ot::kUriPendingSet);
VerifyOrQuit(message != nullptr);
{
MeshCoP::Timestamp timestamp;
timestamp.SetSeconds(kPendingTimestampRouter);
timestamp.SetTicks(0);
SuccessOrQuit(Tlv::Append<MeshCoP::PendingTimestampTlv>(*message, timestamp));
}
SuccessOrQuit(router.Get<MeshCoP::ActiveDatasetManager>().Read(dataset));
{
MeshCoP::Timestamp timestamp;
timestamp.SetSeconds(kActiveTimestampRouter);
timestamp.SetTicks(0);
SuccessOrQuit(Tlv::Append<MeshCoP::ActiveTimestampTlv>(*message, timestamp));
}
timestamp.SetSeconds(kActiveTimestampRouter);
timestamp.SetTicks(0);
SuccessOrQuit(dataset.Write<MeshCoP::ActiveTimestampTlv>(timestamp));
SuccessOrQuit(Tlv::Append<MeshCoP::DelayTimerTlv>(*message, kDelayTimerStep11 * 1000));
timestamp.SetSeconds(kPendingTimestampRouter);
timestamp.SetTicks(0);
SuccessOrQuit(dataset.Write<MeshCoP::PendingTimestampTlv>(timestamp));
Tmf::MessageInfo messageInfo(commissioner.GetInstance());
SuccessOrQuit(dataset.Write<MeshCoP::DelayTimerTlv>(kDelayTimerStep11 * 1000));
SuccessOrQuit(message->AppendBytes(dataset.GetBytes(), dataset.GetLength()));
Tmf::MessageInfo messageInfo(router.GetInstance());
messageInfo.SetSockAddrToRlocPeerAddrToLeaderAloc();
SuccessOrQuit(agent.SendMessage(*message, messageInfo));
}
@@ -424,13 +425,6 @@ void Test9_2_7(void)
// Wait for acceptance and retransmissions if needed
nexus.AdvanceTime(2 * kResponseTime);
{
MeshCoP::Timestamp timestamp;
timestamp = leader.Get<MeshCoP::PendingDatasetManager>().GetTimestamp();
Log("Pending Timestamp: %s, seconds: %llu", timestamp.IsValid() ? "valid" : "invalid",
(unsigned long long)timestamp.GetSeconds());
}
Log("---------------------------------------------------------------------------------------");
Log("Step 12: Leader (DUT)");
@@ -514,7 +508,7 @@ void Test9_2_7(void)
* - PSKc TLV
* - Security Policy TLV
* - Active Timestamp TLV: 20s
* - Pending Timestamp TLV: 100s
* - Pending Timestamp TLV: 30s
*/
nexus.AdvanceTime(kResponseTime);
@@ -605,7 +599,7 @@ void Test9_2_7(void)
* - Description: Automatically sends a unicast MLE Data Request to the DUT with the new active timestamp and
* pending timestamp:
* - Active Timestamp TLV: 20s
* - Pending Timestamp TLV: 100s
* - Pending Timestamp TLV: 40s
* - Pass Criteria: N/A
*/
+7 -3
View File
@@ -238,6 +238,8 @@ def verify(pv):
print("Step 13: Leader (DUT) multicasts a MLE Data Response.")
pkts.filter_LLANMA().\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: p.mle.tlv.active_tstamp == ACTIVE_TIMESTAMP_STEP_5 and\
p.mle.tlv.pending_tstamp == PENDING_TIMESTAMP_ROUTER).\
must_next()
# Step 15: Router
@@ -268,7 +270,7 @@ def verify(pv):
pkts.filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: p.mle.tlv.active_tstamp == ACTIVE_TIMESTAMP_STEP_5 and\
p.mle.tlv.pending_tstamp == PENDING_TIMESTAMP_ROUTER and\
DELAY_TIMER_STEP_11 * 1000 - 10000 <= p.thread_meshcop.tlv.delay_timer <= DELAY_TIMER_STEP_11 * 1000).\
DELAY_TIMER_STEP_11 * 1000 - 120000 <= p.thread_meshcop.tlv.delay_timer <= DELAY_TIMER_STEP_11 * 1000).\
must_next()
# Steps 17-21 can be interleaved
@@ -299,13 +301,15 @@ def verify(pv):
print("Step 19: Leader (DUT) sends a multicast MLE Data Response.")
pkts.filter_LLANMA().\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: p.mle.tlv.active_tstamp == ACTIVE_TIMESTAMP_STEP_5 and\
p.mle.tlv.pending_tstamp == PENDING_TIMESTAMP_COMMISSIONER).\
must_next()
# Step 20: Router
# - Description: Automatically sends a unicast MLE Data Request to the DUT with the new active timestamp and
# pending timestamp:
# - Active Timestamp TLV: 20s
# - Pending Timestamp TLV: 100s
# - Pending Timestamp TLV: 40s
# - Pass Criteria: N/A
print("Step 20: Router sends a unicast MLE Data Request to the DUT.")
@@ -314,7 +318,7 @@ def verify(pv):
pkts.filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: p.mle.tlv.active_tstamp == ACTIVE_TIMESTAMP_STEP_5 and\
p.mle.tlv.pending_tstamp == PENDING_TIMESTAMP_COMMISSIONER and\
DELAY_TIMER_STEP_17 * 1000 - 10000 <= p.thread_meshcop.tlv.delay_timer <= DELAY_TIMER_STEP_17 * 1000).\
0 <= p.thread_meshcop.tlv.delay_timer <= DELAY_TIMER_STEP_17 * 1000).\
must_next()
# Step 22: All