mirror of
https://github.com/espressif/openthread.git
synced 2026-08-30 13:59:54 +00:00
[nexus] fix flakiness in test 1.1.8.1.1 (#12646)
This commit addresses occasional failures in Nexus Test 1.1.8.1.1 by improving simulation timing and packet verification robustness. Changes: - Increased kJoiningProcessTime from 30s to 60s in the C++ test to provide a larger buffer for the joiner process to complete. - Added a 1s delay after calling AddJoinerAny() to ensure the leader processes the steering data update before discovery starts. - Refactored the Python verification script to use pkts.copy() for independent message exchanges (JOIN_ENT and DTLS Alert). This allows the script to handle timing variations and out-of-order packets in the simulated capture. - Corrected the NM_PROVISIONING_URL_TLV constant to 32. - Added dtls.alert_message.level to the pktverify library to enable verification of DTLS alert severity levels.
This commit is contained in:
@@ -47,7 +47,7 @@ static constexpr uint32_t kCommissionerStartTime = 1 * Time::kOneSecondInMsec;
|
||||
/**
|
||||
* Time to advance for the Joiner to complete the joining process, in milliseconds.
|
||||
*/
|
||||
static constexpr uint32_t kJoiningProcessTime = 30 * Time::kOneSecondInMsec;
|
||||
static constexpr uint32_t kJoiningProcessTime = 60 * Time::kOneSecondInMsec;
|
||||
|
||||
/**
|
||||
* The timeout for the Joiner entry on Commissioner, in seconds.
|
||||
@@ -200,6 +200,7 @@ void Test1_1_8_1_1(void)
|
||||
#endif
|
||||
|
||||
SuccessOrQuit(commissioner.AddJoinerAny(kPskd, kJoinerTimeout));
|
||||
nexus.AdvanceTime(Time::kOneSecondInMsec);
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 3: Joiner_1");
|
||||
|
||||
@@ -46,6 +46,7 @@ JOIN_ENT_URI = '/c/je'
|
||||
NM_PROVISIONING_URL_TLV = 32
|
||||
MLE_SEC_SUITE_NONE = 255
|
||||
JOINER_UDP_PORT = 49153
|
||||
|
||||
ALERT_DESC_CLOSE_NOTIFY = 0
|
||||
ALERT_LEVEL_FATAL = 2
|
||||
DTLS_PORT = 1000
|
||||
@@ -245,20 +246,9 @@ def verify(pv):
|
||||
filter(lambda p: p.udp.srcport in COMMISSIONER_UDP_PORTS).\
|
||||
must_next()
|
||||
|
||||
# - 13. Joiner_1 sends an encrypted DTLS-Alert record with a code of 0 (close_notify) to Commissioner.
|
||||
# Note: OpenThread Joiner sends close_notify immediately after receiving JOIN_FIN.rsp, while it expects
|
||||
# JOIN_ENT.ntf over the mesh. The spec lists 11, 12, 13 but these are independent exchanges.
|
||||
print("Step 5.13: Joiner_1 sends DTLS-Alert (close_notify).")
|
||||
pkts.filter_wpan_src64(JOINER).\
|
||||
filter_wpan_dst64(COMMISSIONER).\
|
||||
filter(lambda p: consts.CONTENT_ALERT in p.dtls.record.content_type).\
|
||||
filter(lambda p: p.dtls.alert_message.desc == ALERT_DESC_CLOSE_NOTIFY).\
|
||||
filter(lambda p: p.udp.dstport in COMMISSIONER_UDP_PORTS).\
|
||||
must_next()
|
||||
|
||||
# - 11. Commissioner sends an encrypted JOIN_ENT.ntf message to Joiner_1.
|
||||
print("Step 5.11: Commissioner sends JOIN_ENT.ntf (Encrypted).")
|
||||
pkts.filter_wpan_src64(COMMISSIONER).\
|
||||
pkts.copy().filter_wpan_src64(COMMISSIONER).\
|
||||
filter_wpan_dst64(JOINER).\
|
||||
filter(lambda p: p.wpan.security == True).\
|
||||
must_next()
|
||||
@@ -266,11 +256,22 @@ def verify(pv):
|
||||
# - 12. Joiner_1 receives the encrypted JOIN_ENT.ntf message and sends an encrypted JOIN_ENT.ntf dummy response
|
||||
# to Commissioner.
|
||||
print("Step 5.12: Joiner_1 sends JOIN_ENT.ntf response (Encrypted).")
|
||||
pkts.filter_wpan_src64(JOINER).\
|
||||
pkts.copy().filter_wpan_src64(JOINER).\
|
||||
filter_wpan_dst64(COMMISSIONER).\
|
||||
filter(lambda p: p.wpan.security == True).\
|
||||
must_next()
|
||||
|
||||
# - 13. Joiner_1 sends an encrypted DTLS-Alert record with a code of 0 (close_notify) to Commissioner.
|
||||
# Note: OpenThread Joiner sends close_notify immediately after receiving JOIN_FIN.rsp, while it expects
|
||||
# JOIN_ENT.ntf over the mesh. The spec lists 11, 12, 13 but these are independent exchanges.
|
||||
print("Step 5.13: Joiner_1 sends DTLS-Alert (close_notify).")
|
||||
pkts.copy().filter_wpan_src64(JOINER).\
|
||||
filter_wpan_dst64(COMMISSIONER).\
|
||||
filter(lambda p: consts.CONTENT_ALERT in p.dtls.record.content_type).\
|
||||
filter(lambda p: p.dtls.alert_message.desc == ALERT_DESC_CLOSE_NOTIFY).\
|
||||
filter(lambda p: p.udp.dstport in COMMISSIONER_UDP_PORTS).\
|
||||
must_next()
|
||||
|
||||
# Fail Conditions:
|
||||
# - 3. A DTLS-Alert record with a Fatal alert level is sent by either Joiner_1 or Commissioner.
|
||||
print("Check for no Fatal DTLS alerts.")
|
||||
|
||||
@@ -562,6 +562,7 @@ _LAYER_FIELDS = {
|
||||
'dtls.handshake.cookie': _auto,
|
||||
'dtls.record.content_type': _list(_auto),
|
||||
'dtls.alert_message.desc': _auto,
|
||||
'dtls.alert_message.level': _auto,
|
||||
|
||||
# thread beacon
|
||||
'thread_bcn.protocol': _auto,
|
||||
|
||||
Reference in New Issue
Block a user