[nexus] fix flakiness in 1_2_MATN_TC_9 test (#12781)

This commit fixes an intermittent failure in the Nexus test
1_2_MATN_TC_9 by ensuring that the packet verification for Step 4b
does not advance the packet cursor prematurely.

In Step 4b, the test verifies that BR_2 (DUT) becomes the leader and
distributes its BBR dataset. It checks for both an MLE Advertisement
and an MLE Data Response from BR_2. However, these packets may arrive
in either order.

Previously, the check for the MLE Advertisement used must_next(),
which advanced the packet cursor. If the MLE Data Response arrived
before the Advertisement, the subsequent check for the Data Response
would fail because it started searching from after the Advertisement.

By using copy() for the MLE Advertisement check, we ensure that both
checks search from the same point in the packet log, making the test
robust against packet reordering.
This commit is contained in:
Jonathan Hui
2026-03-26 23:11:07 -05:00
committed by GitHub
parent 112458b743
commit 497e82ad5a
+6 -2
View File
@@ -125,17 +125,21 @@ def verify(pv):
# - • RLOC16 in Server TLV == The RLOC16 of BR_2
# - All fields in the BBR Dataset Service TLV MUST contain valid values.
print("Step 4b: BR_2 (DUT) becomes Leader/PBBR")
pkts.filter_wpan_src64(vars['BR_2']).\
adv_pkts = pkts.copy()
adv_pkts.filter_wpan_src64(vars['BR_2']).\
filter_mle_cmd(consts.MLE_ADVERTISEMENT).\
filter(lambda p: p.mle.tlv.leader_data.router_id == vars['BR_2_RLOC16'] >> 10).\
must_next()
pkts.filter_wpan_src64(vars['BR_2']).\
dr_pkts = pkts.copy()
dr_pkts.filter_wpan_src64(vars['BR_2']).\
filter_mle_cmd(consts.MLE_DATA_RESPONSE).\
filter_has_bbr_dataset().\
filter(lambda p: vars['BR_2_RLOC16'] in p.thread_nwd.tlv.server_16).\
must_next()
pkts.index = pv.max_index(adv_pkts.index, dr_pkts.index)
# Step 5
# - Device: Router
# - Description: Harness instructs the device to send a ICMPv6 Echo (ping) Request packet to the multicast address,