[thread-cert] relax TLV type checks in pktverify (#10627)

This commit modifies thread-cert scripts utilizing `pktverify` to
adopt a more flexible approach to TLV type checking. Specifically, it
replaces strict equality (`==`) or strict subset (`<`) checks with a
subset or equal check (`<=`) when verifying the presence of TLVs in a
message. This adjustment ensures that test scripts adhere to the
principle of ignoring extra or unknown TLVs, thereby future-proofing
them against potential protocol updates that might introduce new
TLVs.
This commit is contained in:
Abtin Keshavarzian
2024-08-27 08:18:45 -07:00
committed by GitHub
parent abb6934cdd
commit 8f2ddf93c3
63 changed files with 205 additions and 205 deletions
@@ -113,16 +113,16 @@ class Cert_6_3_2_NetworkDataUpdate(thread_cert.TestCase):
# Step 3: The DUT MUST send a MLE Child Update Request to the Leader
_epkts.range(pkts.index).filter_mle_cmd(MLE_CHILD_UPDATE_REQUEST).must_next().must_verify(
lambda p: p.wpan.dst64 == LEADER and {LEADER_DATA_TLV, ADDRESS_REGISTRATION_TLV, MODE_TLV, TIMEOUT_TLV
} < set(p.mle.tlv.type))
} <= set(p.mle.tlv.type))
# Step 10: The DUT MUST send a MLE Data Request frame to
# request the updated Network Data
_epkts.filter_mle_cmd(MLE_DATA_REQUEST).must_next().must_verify(
lambda p: {TLV_REQUEST_TLV, NETWORK_DATA_TLV} < set(p.mle.tlv.type))
lambda p: {TLV_REQUEST_TLV, NETWORK_DATA_TLV} <= set(p.mle.tlv.type))
# Step 12: The DUT MUST send a MLE Child Update Request to the Leader
_epkts.filter_mle_cmd(MLE_CHILD_UPDATE_REQUEST).filter_wpan_dst64(LEADER).must_next().must_verify(
lambda p: {ADDRESS_REGISTRATION_TLV, MODE_TLV, TIMEOUT_TLV} < set(p.mle.tlv.type))
lambda p: {ADDRESS_REGISTRATION_TLV, MODE_TLV, TIMEOUT_TLV} <= set(p.mle.tlv.type))
if __name__ == '__main__':