[nexus] fix intermittent failures in test 7.1.8 (#12543)

This commit fixes occasional failures in Nexus test 7.1.8 by making
the verification script more robust against interleaved packets.

The implementation details:
- tests/nexus/verify_7_1_8.py: Refactored Step 3 to use separate
  filter copies to find the Leader's MLE Data Response and CoAP ACK
  independently of their order.
- Correctly updated the main packet filter index to ensure that
  subsequent verification steps proceed from the point after both
  packets have been identified.
This commit is contained in:
Jonathan Hui
2026-02-24 18:03:53 -06:00
committed by GitHub
parent e6003bc9af
commit 41dddb5ed3
+26 -18
View File
@@ -101,17 +101,25 @@ def verify(pv):
# on FED_1.
# - Pass Criteria: N/A.
print("Step 3: Leader transmits a 2.04 Changed CoAP response and multicast MLE Data Response.")
pkts.filter_wpan_src64(LEADER).\
filter_LLANMA().\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: {
PREFIX_1,
PREFIX_2
} <= set(p.thread_nwd.tlv.prefix)).\
must_next()
pkts.filter_wpan_src64(LEADER).\
filter_coap_ack(consts.SVR_DATA_URI).\
must_next()
# We use two separate filters to find MLE Data Response and CoAP ACK independently,
# as their order is not guaranteed.
mle_filter = pkts.copy().\
filter_wpan_src64(LEADER).\
filter_LLANMA().\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: {
PREFIX_1,
PREFIX_2
} <= set(p.thread_nwd.tlv.prefix))
mle_filter.must_next()
coap_filter = pkts.copy().\
filter_wpan_src64(LEADER).\
filter_coap_ack(consts.SVR_DATA_URI)
coap_filter.must_next()
# Advance the main filter's index past both packets.
pkts.index = (max(mle_filter.index[0], coap_filter.index[0]), max(mle_filter.index[1], coap_filter.index[1]))
# Step 4: Router_1 (DUT)
# - Description: Automatically transmits multicast MLE Data Response with the new information collected, adding
@@ -119,13 +127,13 @@ def verify(pv):
# - Pass Criteria: The DUT MUST send a multicast MLE Data Response.
print("Step 4: Router_1 (DUT) transmits multicast MLE Data Response.")
pkts.filter_wpan_src64(ROUTER_1).\
filter_LLANMA().\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: {
PREFIX_1,
PREFIX_2
} <= set(p.thread_nwd.tlv.prefix)).\
must_next()
filter_LLANMA().\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter(lambda p: {
PREFIX_1,
PREFIX_2
} <= set(p.thread_nwd.tlv.prefix)).\
must_next()
# Step 5: FED_1
# - Description: Harness silently powers-down FED_1 and waits for Router_1 to remove FED_1 from its neighbor