From 1957266286e9fc615d15622705293cb74ce9be00 Mon Sep 17 00:00:00 2001 From: Martin Turon Date: Mon, 9 May 2022 12:42:47 -0700 Subject: [PATCH] [sleepy] Rename sleepy params per spec. (#17927) * [sleepy] Initial rename of CRA/CRI to SAI/SII. * [sleepy] More CRA/CRI -> SAI/SII rename. * [sleepy] Update comments per review. * [sleepy] Test mainline case: SAI < SII. * [sleepy] Fix test after SAI < SII. --- .../suites/certification/Test_TC_SC_4_5.yaml | 4 +- src/controller/CHIPDeviceController.cpp | 2 +- src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp | 22 +++-- src/lib/dnssd/Discovery_ImplPlatform.cpp | 14 +-- src/lib/dnssd/Resolver.h | 2 +- src/lib/dnssd/TxtFields.cpp | 8 +- src/lib/dnssd/TxtFields.h | 12 +-- .../minimal_mdns/tests/TestAdvertiser.cpp | 19 ++-- src/lib/dnssd/platform/tests/TestPlatform.cpp | 10 +-- src/lib/dnssd/tests/TestTxtFields.cpp | 88 +++++++++---------- 10 files changed, 90 insertions(+), 91 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml index 33ac99b1ebfca8..9f385e2189f443 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_4_5.yaml @@ -27,7 +27,7 @@ tests: verification: "1. On the raspi controller, publish matter service, using below command $avahi-publish-service 87E1B004E235A130-8FC7772401CD0696 - _matter._tcp 22222 CRI=3000 CRA=4000 T=0" + _matter._tcp 22222 SII=3000 SAI=2000 T=0" disabled: true - label: @@ -51,7 +51,7 @@ tests: verification: "1. On the raspi controller, publish matter service chanding the T value 1, using below command $avahi-publish-service - 87E1B004E235A130-8FC7772401CD0696 _matter._tcp 22222 CRI=3000 CRA=4000 + 87E1B004E235A130-8FC7772401CD0696 _matter._tcp 22222 SII=3000 SAI=2000 T=1" disabled: true diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index c62755a15f7bd4..2d75459bb8acf5 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -612,7 +612,7 @@ CHIP_ERROR DeviceCommissioner::EstablishPASEConnection(NodeId remoteDeviceId, Re } } #endif - // TODO: In some cases like PASE over IP, CRA and CRI values from commissionable node service should be used + // TODO: In some cases like PASE over IP, SAI and SII values from commissionable node service should be used session = mSystemState->SessionMgr()->CreateUnauthenticatedSession(params.GetPeerAddress(), device->GetRemoteMRPConfig()); VerifyOrExit(session.HasValue(), err = CHIP_ERROR_NO_MEMORY); diff --git a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp index 7a27f8738ba8dc..d8c13907fc4598 100644 --- a/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Advertiser_ImplMinimalMdns.cpp @@ -206,9 +206,8 @@ class AdvertiserMinMdns : public ServiceAdvertiser, struct CommonTxtEntryStorage { // +2 for all to account for '=' and terminating nullchar - char mrpRetryIntervalIdleBuf[KeySize(TxtFieldKey::kMrpRetryIntervalIdle) + ValSize(TxtFieldKey::kMrpRetryIntervalIdle) + 2]; - char mrpRetryIntervalActiveBuf[KeySize(TxtFieldKey::kMrpRetryIntervalActive) + - ValSize(TxtFieldKey::kMrpRetryIntervalActive) + 2]; + char sleepyIdleIntervalBuf[KeySize(TxtFieldKey::kSleepyIdleInterval) + ValSize(TxtFieldKey::kSleepyIdleInterval) + 2]; + char sleepyActiveIntervalBuf[KeySize(TxtFieldKey::kSleepyActiveInterval) + ValSize(TxtFieldKey::kSleepyActiveInterval) + 2]; char tcpSupportedBuf[KeySize(TxtFieldKey::kTcpSupported) + ValSize(TxtFieldKey::kTcpSupported) + 2]; }; template @@ -227,13 +226,13 @@ class AdvertiserMinMdns : public ServiceAdvertiser, "MRP retry interval idle value exceeds allowed range of 1 hour, using maximum available"); mrp.mIdleRetransTimeout = kMaxRetryInterval; } - size_t writtenCharactersNumber = snprintf(storage.mrpRetryIntervalIdleBuf, sizeof(storage.mrpRetryIntervalIdleBuf), - "CRI=%" PRIu32, mrp.mIdleRetransTimeout.count()); + size_t writtenCharactersNumber = snprintf(storage.sleepyIdleIntervalBuf, sizeof(storage.sleepyIdleIntervalBuf), + "SII=%" PRIu32, mrp.mIdleRetransTimeout.count()); VerifyOrReturnError((writtenCharactersNumber > 0) && - (writtenCharactersNumber < sizeof(storage.mrpRetryIntervalIdleBuf)), + (writtenCharactersNumber < sizeof(storage.sleepyIdleIntervalBuf)), CHIP_ERROR_INVALID_STRING_LENGTH); - txtFields[numTxtFields++] = storage.mrpRetryIntervalIdleBuf; + txtFields[numTxtFields++] = storage.sleepyIdleIntervalBuf; } { @@ -243,13 +242,12 @@ class AdvertiserMinMdns : public ServiceAdvertiser, "MRP retry interval active value exceeds allowed range of 1 hour, using maximum available"); mrp.mActiveRetransTimeout = kMaxRetryInterval; } - size_t writtenCharactersNumber = - snprintf(storage.mrpRetryIntervalActiveBuf, sizeof(storage.mrpRetryIntervalActiveBuf), "CRA=%" PRIu32, - mrp.mActiveRetransTimeout.count()); + size_t writtenCharactersNumber = snprintf(storage.sleepyActiveIntervalBuf, sizeof(storage.sleepyActiveIntervalBuf), + "SAI=%" PRIu32, mrp.mActiveRetransTimeout.count()); VerifyOrReturnError((writtenCharactersNumber > 0) && - (writtenCharactersNumber < sizeof(storage.mrpRetryIntervalActiveBuf)), + (writtenCharactersNumber < sizeof(storage.sleepyActiveIntervalBuf)), CHIP_ERROR_INVALID_STRING_LENGTH); - txtFields[numTxtFields++] = storage.mrpRetryIntervalActiveBuf; + txtFields[numTxtFields++] = storage.sleepyActiveIntervalBuf; } } if (params.GetTcpSupported().HasValue()) diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index b4a0e4bf258f83..b0733a6519ff30 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -287,9 +287,9 @@ CHIP_ERROR CopyTxtRecord(TxtFieldKey key, char * buffer, size_t bufferLen, const { case TxtFieldKey::kTcpSupported: return CopyTextRecordValue(buffer, bufferLen, params.GetTcpSupported()); - case TxtFieldKey::kMrpRetryIntervalIdle: - case TxtFieldKey::kMrpRetryIntervalActive: - return CopyTextRecordValue(buffer, bufferLen, params.GetMRPConfig(), key == TxtFieldKey::kMrpRetryIntervalIdle); + case TxtFieldKey::kSleepyIdleInterval: + case TxtFieldKey::kSleepyActiveInterval: + return CopyTextRecordValue(buffer, bufferLen, params.GetMRPConfig(), key == TxtFieldKey::kSleepyIdleInterval); default: return CHIP_ERROR_INVALID_ARGUMENT; } @@ -537,8 +537,8 @@ CHIP_ERROR DiscoveryImplPlatform::Advertise(const OperationalAdvertisingParamete { PREPARE_RECORDS(Operational); - ADD_TXT_RECORD(MrpRetryIntervalIdle); - ADD_TXT_RECORD(MrpRetryIntervalActive); + ADD_TXT_RECORD(SleepyIdleInterval); + ADD_TXT_RECORD(SleepyActiveInterval); ADD_TXT_RECORD(TcpSupported); ADD_PTR_RECORD(CompressedFabricId); @@ -555,8 +555,8 @@ CHIP_ERROR DiscoveryImplPlatform::Advertise(const CommissionAdvertisingParameter ADD_TXT_RECORD(VendorProduct); ADD_TXT_RECORD(DeviceType); ADD_TXT_RECORD(DeviceName); - ADD_TXT_RECORD(MrpRetryIntervalIdle); - ADD_TXT_RECORD(MrpRetryIntervalActive); + ADD_TXT_RECORD(SleepyIdleInterval); + ADD_TXT_RECORD(SleepyActiveInterval); ADD_TXT_RECORD(TcpSupported); ADD_PTR_RECORD(VendorId); diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index e11822099d9f31..44887865a21cc9 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -68,7 +68,7 @@ struct ResolvedNodeData bool IsDeviceTreatedAsSleepy(const ReliableMessageProtocolConfig * defaultMRPConfig) const { - // If either retry interval (Idle - CRI, Active - CRA) has a value and that value is greater + // If either sleepy interval (Idle - SII, Active - SAI) has a value and that value is greater // than the value passed to this function, then the peer device will be treated as if it is // a Sleepy End Device (SED) return (mMrpRetryIntervalIdle.HasValue() && (mMrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || diff --git a/src/lib/dnssd/TxtFields.cpp b/src/lib/dnssd/TxtFields.cpp index b681e41cd41fc3..af9d7de02c013f 100644 --- a/src/lib/dnssd/TxtFields.cpp +++ b/src/lib/dnssd/TxtFields.cpp @@ -225,10 +225,10 @@ void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & val, DiscoveredN case TxtFieldKey::kPairingHint: nodeData.pairingHint = Internal::GetPairingHint(val); break; - case TxtFieldKey::kMrpRetryIntervalIdle: + case TxtFieldKey::kSleepyIdleInterval: nodeData.mrpRetryIntervalIdle = Internal::GetRetryInterval(val); break; - case TxtFieldKey::kMrpRetryIntervalActive: + case TxtFieldKey::kSleepyActiveInterval: nodeData.mrpRetryIntervalActive = Internal::GetRetryInterval(val); break; case TxtFieldKey::kTcpSupported: @@ -243,10 +243,10 @@ void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & value, ResolvedN { switch (Internal::GetTxtFieldKey(key)) { - case TxtFieldKey::kMrpRetryIntervalIdle: + case TxtFieldKey::kSleepyIdleInterval: nodeData.mMrpRetryIntervalIdle = Internal::GetRetryInterval(value); break; - case TxtFieldKey::kMrpRetryIntervalActive: + case TxtFieldKey::kSleepyActiveInterval: nodeData.mMrpRetryIntervalActive = Internal::GetRetryInterval(value); break; case TxtFieldKey::kTcpSupported: diff --git a/src/lib/dnssd/TxtFields.h b/src/lib/dnssd/TxtFields.h index d32daea3d96982..7605923afaeb37 100644 --- a/src/lib/dnssd/TxtFields.h +++ b/src/lib/dnssd/TxtFields.h @@ -31,8 +31,8 @@ namespace Dnssd { using namespace System::Clock::Literals; // Operational node TXT entries -static constexpr size_t kKeyMrpRetryIntervalIdleMaxLength = 7; // [CRI] 0-3600000 -static constexpr size_t kKeyMrpRetryIntervalActiveMaxLength = 7; // [CRA] 0-3600000 +static constexpr size_t kKeySleepyIdleIntervalMaxLength = 7; // [SII] 0-3600000 +static constexpr size_t kKeySleepyActiveIntervalMaxLength = 7; // [SAI] 0-3600000 static constexpr System::Clock::Milliseconds32 kMaxRetryInterval = 3600000_ms32; static constexpr size_t kKeyTcpSupportedMaxLength = 1; @@ -66,8 +66,8 @@ enum class TxtFieldKey : uint8_t kRotatingDeviceId, kPairingInstruction, kPairingHint, - kMrpRetryIntervalIdle, - kMrpRetryIntervalActive, + kSleepyIdleInterval, + kSleepyActiveInterval, kTcpSupported, kCount, }; @@ -92,8 +92,8 @@ constexpr const TxtFieldInfo txtFieldInfo[static_cast(TxtFieldKey::kCoun { TxtFieldKey::kRotatingDeviceId, kKeyRotatingDeviceIdMaxLength, "RI", TxtKeyUse::kCommission }, { TxtFieldKey::kPairingInstruction, kKeyPairingInstructionMaxLength, "PI", TxtKeyUse::kCommission }, { TxtFieldKey::kPairingHint, kKeyPairingHintMaxLength, "PH", TxtKeyUse::kCommission }, - { TxtFieldKey::kMrpRetryIntervalIdle, kKeyMrpRetryIntervalIdleMaxLength, "CRI", TxtKeyUse::kCommon }, - { TxtFieldKey::kMrpRetryIntervalActive, kKeyMrpRetryIntervalActiveMaxLength, "CRA", TxtKeyUse::kCommon }, + { TxtFieldKey::kSleepyIdleInterval, kKeySleepyIdleIntervalMaxLength, "SII", TxtKeyUse::kCommon }, + { TxtFieldKey::kSleepyActiveInterval, kKeySleepyActiveIntervalMaxLength, "SAI", TxtKeyUse::kCommon }, { TxtFieldKey::kTcpSupported, kKeyTcpSupportedMaxLength, "T", TxtKeyUse::kCommon }, }; #ifdef CHIP_CONFIG_TEST diff --git a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp index 3acfa4a88951de..0741cd6933b4fb 100644 --- a/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp +++ b/src/lib/dnssd/minimal_mdns/tests/TestAdvertiser.cpp @@ -72,13 +72,14 @@ FullQName kCompressedIdSubName2 = FullQName(kCompressedIdSubPart PtrResourceRecord ptrServiceSubCompressedId1 = PtrResourceRecord(kDnsSdQueryName, kCompressedIdSubName1); PtrResourceRecord ptrServiceSubCompressedId2 = PtrResourceRecord(kDnsSdQueryName, kCompressedIdSubName2); -OperationalAdvertisingParameters operationalParams1 = OperationalAdvertisingParameters() - .SetPeerId(kPeerId1) - .SetMac(ByteSpan(kMac)) - .SetPort(CHIP_PORT) - .EnableIpV4(true) - .SetTcpSupported(chip::Optional(false)) - .SetMRPConfig(ReliableMessageProtocolConfig(32_ms32, 33_ms32)); +OperationalAdvertisingParameters operationalParams1 = + OperationalAdvertisingParameters() + .SetPeerId(kPeerId1) + .SetMac(ByteSpan(kMac)) + .SetPort(CHIP_PORT) + .EnableIpV4(true) + .SetTcpSupported(chip::Optional(false)) + .SetMRPConfig(ReliableMessageProtocolConfig(32_ms32, 30_ms32)); // Match SII, SAI below OperationalAdvertisingParameters operationalParams2 = OperationalAdvertisingParameters().SetPeerId(kPeerId2).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); OperationalAdvertisingParameters operationalParams3 = @@ -89,7 +90,7 @@ OperationalAdvertisingParameters operationalParams5 = OperationalAdvertisingParameters().SetPeerId(kPeerId5).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); OperationalAdvertisingParameters operationalParams6 = OperationalAdvertisingParameters().SetPeerId(kPeerId6).SetMac(ByteSpan(kMac)).SetPort(CHIP_PORT).EnableIpV4(true); -const QNamePart txtOperational1Parts[] = { "CRI=32", "CRA=33", "T=0" }; +const QNamePart txtOperational1Parts[] = { "SII=32", "SAI=30", "T=0" }; PtrResourceRecord ptrOperationalService = PtrResourceRecord(kDnsSdQueryName, kMatterOperationalQueryName); PtrResourceRecord ptrOperational1 = PtrResourceRecord(kMatterOperationalQueryName, kInstanceName1); SrvResourceRecord srvOperational1 = SrvResourceRecord(kInstanceName1, kHostnameName, CHIP_PORT); @@ -182,7 +183,7 @@ CommissionAdvertisingParameters commissionableNodeParamsLargeEnhanced = .SetMRPConfig(ReliableMessageProtocolConfig(3600000_ms32, 3600005_ms32)); QNamePart txtCommissionableNodeParamsLargeEnhancedParts[] = { "D=22", "VP=555+897", "CM=2", "DT=70000", "DN=testy-test", "RI=id_that_spins", "PI=Pair me", "PH=3", - "CRA=3600000", "CRI=3600000", "T=1" }; + "SAI=3600000", "SII=3600000", "T=1" }; FullQName txtCommissionableNodeParamsLargeEnhancedName = FullQName(txtCommissionableNodeParamsLargeEnhancedParts); TxtResourceRecord txtCommissionableNodeParamsLargeEnhanced = TxtResourceRecord(instanceName, txtCommissionableNodeParamsLargeEnhancedName); diff --git a/src/lib/dnssd/platform/tests/TestPlatform.cpp b/src/lib/dnssd/platform/tests/TestPlatform.cpp index 137060a598a563..e8498ce2947b8a 100644 --- a/src/lib/dnssd/platform/tests/TestPlatform.cpp +++ b/src/lib/dnssd/platform/tests/TestPlatform.cpp @@ -51,7 +51,7 @@ OperationalAdvertisingParameters operationalParams2 = OperationalAdvertisingPara .SetMac(ByteSpan(kMac)) .SetPort(CHIP_PORT) .EnableIpV4(true) - .SetMRPConfig({ 32_ms32, 33_ms32 }) + .SetMRPConfig({ 32_ms32, 30_ms32 }) // SII and SAI to match below .SetTcpSupported(Optional(true)); test::ExpectedCall operationalCall2 = test::ExpectedCall() .SetProtocol(DnssdServiceProtocol::kDnssdProtocolTcp) @@ -59,8 +59,8 @@ test::ExpectedCall operationalCall2 = test::ExpectedCall() .SetInstanceName("5555666677778888-1212343456567878") .SetHostName(host) .AddSubtype("_I5555666677778888") - .AddTxt("CRI", "32") - .AddTxt("CRA", "33") + .AddTxt("SII", "32") + .AddTxt("SAI", "30") .AddTxt("T", "1"); CommissionAdvertisingParameters commissionableNodeParamsSmall = @@ -110,8 +110,8 @@ test::ExpectedCall commissionableLargeBasic = test::ExpectedCall() .AddTxt("PI", "Pair me") .AddTxt("PH", "3") .AddTxt("T", "1") - .AddTxt("CRI", "3600000") - .AddTxt("CRA", "3600000") + .AddTxt("SII", "3600000") + .AddTxt("SAI", "3600000") .AddSubtype("_S2") .AddSubtype("_L22") .AddSubtype("_V555") diff --git a/src/lib/dnssd/tests/TestTxtFields.cpp b/src/lib/dnssd/tests/TestTxtFields.cpp index 90d96d1b176a59..5b97a618724dd5 100644 --- a/src/lib/dnssd/tests/TestTxtFields.cpp +++ b/src/lib/dnssd/tests/TestTxtFields.cpp @@ -68,11 +68,11 @@ void TestGetTxtFieldKey(nlTestSuite * inSuite, void * inContext) strcpy(key, "PH"); NL_TEST_ASSERT(inSuite, GetTxtFieldKey(GetSpan(key)) == TxtFieldKey::kPairingHint); - strcpy(key, "CRI"); - NL_TEST_ASSERT(inSuite, GetTxtFieldKey(GetSpan(key)) == TxtFieldKey::kMrpRetryIntervalIdle); + strcpy(key, "SII"); + NL_TEST_ASSERT(inSuite, GetTxtFieldKey(GetSpan(key)) == TxtFieldKey::kSleepyIdleInterval); - strcpy(key, "CRA"); - NL_TEST_ASSERT(inSuite, GetTxtFieldKey(GetSpan(key)) == TxtFieldKey::kMrpRetryIntervalActive); + strcpy(key, "SAI"); + NL_TEST_ASSERT(inSuite, GetTxtFieldKey(GetSpan(key)) == TxtFieldKey::kSleepyActiveInterval); strcpy(key, "T"); NL_TEST_ASSERT(inSuite, GetTxtFieldKey(GetSpan(key)) == TxtFieldKey::kTcpSupported); @@ -404,23 +404,23 @@ void ResetRetryIntervalActive(ResolvedNodeData & nodeData) nodeData.mMrpRetryIntervalActive.ClearValue(); } -// Test CRI +// Test SAI (formally CRI) template -void TxtFieldMrpRetryIntervalIdle(nlTestSuite * inSuite, void * inContext) +void TxtFieldSleepyIdleInterval(nlTestSuite * inSuite, void * inContext) { char key[4]; char val[16]; NodeData nodeData; // Minimum - strcpy(key, "CRI"); + strcpy(key, "SII"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, nodeData.GetMrpRetryIntervalIdle().HasValue()); NL_TEST_ASSERT(inSuite, nodeData.GetMrpRetryIntervalIdle().Value() == 1_ms32); // Maximum - strcpy(key, "CRI"); + strcpy(key, "SII"); strcpy(val, "3600000"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, nodeData.GetMrpRetryIntervalIdle().HasValue()); @@ -430,60 +430,60 @@ void TxtFieldMrpRetryIntervalIdle(nlTestSuite * inSuite, void * inContext) ResetRetryIntervalIdle(nodeData); NL_TEST_ASSERT(inSuite, NodeDataIsEmpty(nodeData)); - // Invalid CRI - negative value - strcpy(key, "CRI"); + // Invalid SII - negative value + strcpy(key, "SII"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalIdle().HasValue()); - // Invalid CRI - greater than maximum - strcpy(key, "CRI"); + // Invalid SII - greater than maximum + strcpy(key, "SII"); strcpy(val, "3600001"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalIdle().HasValue()); - // Invalid CRI - much greater than maximum - strcpy(key, "CRI"); + // Invalid SII - much greater than maximum + strcpy(key, "SII"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalIdle().HasValue()); - // Invalid CRI - hexadecimal value - strcpy(key, "CRI"); + // Invalid SII - hexadecimal value + strcpy(key, "SII"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalIdle().HasValue()); - // Invalid CRI - leading zeros - strcpy(key, "CRI"); + // Invalid SII - leading zeros + strcpy(key, "SII"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalIdle().HasValue()); - // Invalid CRI - text at the end - strcpy(key, "CRI"); + // Invalid SII - text at the end + strcpy(key, "SII"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalIdle().HasValue()); } -// Test CRA +// Test SAI (formerly CRA) template -void TxtFieldMrpRetryIntervalActive(nlTestSuite * inSuite, void * inContext) +void TxtFieldSleepyActiveInterval(nlTestSuite * inSuite, void * inContext) { char key[4]; char val[16]; NodeData nodeData; // Minimum - strcpy(key, "CRA"); + strcpy(key, "SAI"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, nodeData.GetMrpRetryIntervalActive().HasValue()); NL_TEST_ASSERT(inSuite, nodeData.GetMrpRetryIntervalActive().Value() == 1_ms32); // Maximum - strcpy(key, "CRA"); + strcpy(key, "SAI"); strcpy(val, "3600000"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, nodeData.GetMrpRetryIntervalActive().HasValue()); @@ -493,38 +493,38 @@ void TxtFieldMrpRetryIntervalActive(nlTestSuite * inSuite, void * inContext) ResetRetryIntervalActive(nodeData); NL_TEST_ASSERT(inSuite, NodeDataIsEmpty(nodeData)); - // Invalid CRA - negative value - strcpy(key, "CRA"); + // Invalid SAI - negative value + strcpy(key, "SAI"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalActive().HasValue()); - // Invalid CRA - greater than maximum - strcpy(key, "CRA"); + // Invalid SAI - greater than maximum + strcpy(key, "SAI"); strcpy(val, "3600001"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalActive().HasValue()); - // Invalid CRA - much greater than maximum - strcpy(key, "CRA"); + // Invalid SAI - much greater than maximum + strcpy(key, "SAI"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalActive().HasValue()); - // Invalid CRA - hexadecimal value - strcpy(key, "CRA"); + // Invalid SAI - hexadecimal value + strcpy(key, "SAI"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalActive().HasValue()); - // Invalid CRA - leading zeros - strcpy(key, "CRA"); + // Invalid SAI - leading zeros + strcpy(key, "SAI"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalActive().HasValue()); - // Invalid CRA - text at the end - strcpy(key, "CRA"); + // Invalid SAI - text at the end + strcpy(key, "SAI"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.GetMrpRetryIntervalActive().HasValue()); @@ -575,13 +575,13 @@ void TestIsDeviceSleepyIdle(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, !nodeData.IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is the default value, the device is not sleepy - strcpy(key, "CRI"); + strcpy(key, "SII"); sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_DEFAULT_IDLE_RETRY_INTERVAL.count())); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is greater than the default value, the device is sleepy - sprintf(key, "CRI"); + sprintf(key, "SII"); sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_DEFAULT_IDLE_RETRY_INTERVAL.count() + 1)); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, nodeData.IsDeviceTreatedAsSleepy(&defaultMRPConfig)); @@ -601,13 +601,13 @@ void TestIsDeviceSleepyActive(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, !nodeData.IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is the default value, the device is not sleepy - sprintf(key, "CRA"); + sprintf(key, "SAI"); sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL.count())); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, !nodeData.IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is greater than the default value, the device is sleepy - strcpy(key, "CRA"); + strcpy(key, "SAI"); sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_DEFAULT_ACTIVE_RETRY_INTERVAL.count() + 1)); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData); NL_TEST_ASSERT(inSuite, nodeData.IsDeviceTreatedAsSleepy(&defaultMRPConfig)); @@ -626,13 +626,13 @@ const nlTest sTests[] = { NL_TEST_DEF("TxtFieldPairingHint", TestGetPairingHint), // NL_TEST_DEF("TxtFieldPairingInstruction", TestGetPairingInstruction), // NL_TEST_DEF("TxtFieldFillDiscoveredNodeDataFromTxt", TestFillDiscoveredNodeDataFromTxt), // - NL_TEST_DEF("TxtDiscoveredFieldMrpRetryIntervalIdle", TxtFieldMrpRetryIntervalIdle), - NL_TEST_DEF("TxtDiscoveredFieldMrpRetryIntervalActive", TxtFieldMrpRetryIntervalActive), + NL_TEST_DEF("TxtDiscoveredFieldMrpRetryIntervalIdle", TxtFieldSleepyIdleInterval), + NL_TEST_DEF("TxtDiscoveredFieldMrpRetryIntervalActive", TxtFieldSleepyActiveInterval), NL_TEST_DEF("TxtDiscoveredFieldTcpSupport", (TxtFieldTcpSupport) ), NL_TEST_DEF("TxtDiscoveredIsDeviceSleepyIdle", TestIsDeviceSleepyIdle), NL_TEST_DEF("TxtDiscoveredIsDeviceSleepyActive", TestIsDeviceSleepyActive), - NL_TEST_DEF("TxtResolvedFieldMrpRetryIntervalIdle", TxtFieldMrpRetryIntervalIdle), - NL_TEST_DEF("TxtResolvedFieldMrpRetryIntervalActive", TxtFieldMrpRetryIntervalActive), + NL_TEST_DEF("TxtResolvedFieldMrpRetryIntervalIdle", TxtFieldSleepyIdleInterval), + NL_TEST_DEF("TxtResolvedFieldMrpRetryIntervalActive", TxtFieldSleepyActiveInterval), NL_TEST_DEF("TxtResolvedFieldTcpSupport", (TxtFieldTcpSupport) ), NL_TEST_DEF("TxtResolvedIsDeviceSleepyIdle", TestIsDeviceSleepyIdle), NL_TEST_DEF("TxtResolvedIsDeviceSleepyActive", TestIsDeviceSleepyActive),